Payments
How a checkout takes payment: the methods, what happens when the shopper pays, how card details stay safe, and what the shopper sees when a payment does not go through.
<form data-next-checkout data-next-go="upsell.html">
…
<div data-next-payment></div>
<p data-next-query="checkout.errors.payment"></p>
<div data-next-express></div>
<button>Complete order</button>
</form>Methods
The campaign decides which methods show, in the form and as express buttons: a method it adds later shows without an SDK update, under the campaign's name for it, and its form is checked in full. data-next-payment draws the form's, data-next-express the buttons.
| Method | Code | Express button | Form checked before paying in the form |
|---|---|---|---|
| Card | card_token | Every field | |
| PayPal | paypal | ✓ | What requireValidation asks |
| Apple Pay | apple_pay | ✓ (not Android) | What requireValidation asks |
| Google Pay | google_pay | ✓ | What requireValidation asks |
| Shop Pay | shop_pay | ✓ | What requireValidation asks |
| Link | link | ✓ | Every field |
| Klarna | klarna | Every field | |
| Afterpay | afterpay | Every field | |
| Affirm | affirm | Every field | |
| iDEAL | ideal | Every field | |
| Bancontact | bancontact | Every field | |
| SEPA Direct Debit | sepa_debit | Every field | |
| Twint | twint | Every field | |
| Swish | swish | Every field |
The express column is where the payment platform offers a button; the campaign turns each on. Payment methods lists which also take upsells. An express button skips the page's form, as in 0.4.x: the wallet collects and checks the shopper's details itself.
When the shopper pays
- The form is checked, as the table above says.
requireValidationis set innextConfig(Migrating from 0.4.x). - The SDK waits for the cart's latest price, so the order matches what the page shows.
- A card is turned into a token by the payment provider.
- The order is created. Paid at once, the shopper goes to the page
data-next-gonames. Otherwise the shopper goes to the provider to finish (PayPal, Klarna, a wallet, 3-D Secure) and comes back to that page once paid.
Card details
The card number and security code are typed into fields the payment provider hosts, so they never reach the page or the SDK, as PCI DSS asks. Those fields also forget what was typed:
| What | Forgotten | The shopper sees |
|---|---|---|
| Security code (CVV) | 3 minutes after its last digit | Its field asks for it again (payment.card.cvv.errors.cleared) |
| The whole card | 1 hour after the page loaded the card fields | "Your card details timed out" (payment.card.errors.session_expired) |
When a payment does not go through
| What happened | The shopper sees |
|---|---|
| The card is declined | The reason in checkout.errors.payment (payment.errors.<code>, see Language); the cart is kept |
| Not paid at the provider | The checkout again with ?payment_failed=true and the same cart |
| Back from the provider without paying | The checkout as it was; paying again places a new order |
Events for each case: Payment lifecycle.