Charge a payment
Charge a card or bank account in one step with a sale, or check that it's valid without charging it with a verify.
A sale charges a customer's payment method and transfers the funds to the merchant in one step. A verify checks that a payment method is valid without charging it. Use a sale when the merchant can fulfill the order right away. To hold funds now and collect them later, see Authorize and capture a payment.
Before you start, make sure you have the following:
- The merchant's ID, for a merchant with a connection that accepts the payment method. See Supported connections.
- The payment method, as a Preczn token or as card data. See the Tokenization Overview.
- A way to route the transaction: the connection's name in
processor, or a routing plan assigned to the merchant. See Choose a routing method.
Sale
A sale charges a customer's payment method for goods or services, and transfers funds from the customer's account to the merchant's account. This section shows a card. To charge a bank account, see Charge a bank account.
To run a sale, complete the following steps:
-
Send
POST /v1/transactionswithtypeset tosale, themerchantId, thepayment, and theamount. Sendamountas an integer in the smallest currency unit, such as145for $1.45 USD or100for ¥100. Send the payment method as a token inpayment.token, or as card data.{ "merchantId": "{merchantId}", "type": "sale", "payment": { "token": "{tokenId}" }, "amount": 145 }{ "merchantId": "{merchantId}", "type": "sale", "payment": { "number": "4321000000000012", "cvv": "123", "expiration": "1235" }, "amount": 145 } -
Check
authorization.statusin the response.Ameans approved. For the other values, see Transaction status.authorization.cvvandauthorization.avscarry the card's verification results. See Card verification results.{ "id": "{transactionId}", "type": "sale", "amount": 145, "currency": "USD", "merchantId": "{merchantId}", "authorization": { "status": "A", "approvedAmount": 145, "partial": false, "cvv": "M", "avs": "U", "processorCode": "{processorCode}", "processorMessage": "{processorMessage}", "processorTransactionId": "{processorTransactionId}" }, "payment": { "bin": "432100", "brand": "VISA", "last4": "0012", "type": "CREDIT" }, "processor": { "id": "{platformConnectionId}", "name": "Stripe" } }This response is abbreviated. Every transaction type returns the same transaction object. For every field, see Process Transaction.
Verify
A verify checks that a customer's payment method is valid without charging it. Each connection handles it differently, but most run a $0.00 authorization against the account.
The common use is exchanging a single-use token, such as one from PaymentElements, for a multi-use token that you store and reuse later. To learn more about tokens, see the Tokenization Overview.
To verify a payment method, complete the following steps:
-
Send
POST /v1/transactionswithtypeset toverify, themerchantId, and thepayment. To get a multi-use token back, add the?tokenize=truequery parameter. Without it, an approvedverifyreturns no multi-use token.{ "merchantId": "{merchantId}", "type": "verify", "payment": { "number": "4321000000000012", "cvv": "123", "expiration": "1235" } } -
Check
authorization.statusin the response. Averifyresponse carries noamountorapprovedAmount, because nothing is charged.
To verify a bank account, see Verify a bank account. To return funds from a sale, see Void or refund a transaction.
Updated 21 minutes ago
