Save a card for later use
Save a card or bank account as a multi-use token during a transaction, and charge the token on later transactions.
Save a customer's card or bank account during a transaction, and charge it later without asking the customer to enter it again. You send the first transaction with the tokenize=true query parameter, Preczn returns a multi-use token, and you send that token on later transactions in place of the account details.
Use this guide in the following cases:
- Recurring charges. You bill a customer on a schedule, such as a monthly service plan.
- Returning customers. A customer chooses to save a payment method at checkout so they can pay faster next time.
- Charges after checkout. You charge a customer after the visit, such as for an invoice.
The Dashboard doesn't save cards. You save a card through the API.
Prerequisites
- An API key for your platform. Every request uses it in the
x-api-keyheader. - A merchant whose connection processes the transaction. You send its
merchantIdon each request. - The customer's payment details in one of these forms:
- A single-use token from PaymentElements. This is the recommended way to collect card and bank account details.
- The account details, if you use a direct API integration.
- A choice of token scope. A multi-use token belongs to one merchant or to every merchant on your platform, and you can't change the scope later. See Choosing a Token Scope.
Save the payment method and charge it later
-
Send a Sale, Auth, or Verify to Process Transaction, and add
tokenize=trueto the query string:POST /v1/transactions?tokenize=true. To save the card without charging it, send a Verify. For a merchant-scoped token, also addmerchantToken=true. Without it, Preczn creates a platform token.{ "merchantId": "mid_test_{merchantId}", "type": "sale", "amount": 1234, "currency": "USD", "payment": { "token": "tkn_test_{singleUseToken}" } } -
Read the multi-use token from
payment.tokenin the response. Preczn returns a token when the transaction is approved or pending. A declined transaction doesn't return one, and Apple Pay and Google Pay payments don't return a multi-use token. Store the token against the customer in your system.{ "id": "txn_test_{transactionId}", "merchantId": "mid_test_{merchantId}", "type": "sale", "amount": 1234, "authorization": { "status": "A" }, "payment": { "token": "tkn_test_{multiUseToken}", "brand": "VISA", "last4": "0012" } }The response above is shortened to the fields this step uses.
-
On each later charge, send the stored token in
payment.tokento Process Transaction (POST /v1/transactions), in place of the account details. Leave outtokenize=true.{ "merchantId": "mid_test_{merchantId}", "type": "sale", "amount": 1234, "currency": "USD", "payment": { "token": "tkn_test_{multiUseToken}" } }
Multi-use tokens don't store the CVV
Preczn doesn't store the card verification value (CVV) with a multi-use token. Make sure each processor's risk rules don't require a CVV on charges that use a stored token.
If the customer saves the same card number and expiration date again on your platform, Preczn returns the same multi-use token. For a platform token, that's true for every merchant on your platform. A merchant token is separate for each merchant. Bank accounts follow the same steps.
Next
- To tell each processor that a charge uses a stored card, set
tokenUsageas described in Card On File Flags. - To keep the customer's billing details on the token, see Storing Billing Information.
Updated about 2 hours ago
