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.

CODE
<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.

MethodCodeExpress buttonForm checked before paying in the form
Cardcard_tokenEvery field
PayPalpaypal✓What requireValidation asks
Apple Payapple_pay✓ (not Android)What requireValidation asks
Google Paygoogle_pay✓What requireValidation asks
Shop Payshop_pay✓What requireValidation asks
Linklink✓Every field
KlarnaklarnaEvery field
AfterpayafterpayEvery field
AffirmaffirmEvery field
iDEALidealEvery field
BancontactbancontactEvery field
SEPA Direct Debitsepa_debitEvery field
TwinttwintEvery field
SwishswishEvery 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

  1. The form is checked, as the table above says. requireValidation is set in nextConfig (Migrating from 0.4.x).
  2. The SDK waits for the cart's latest price, so the order matches what the page shows.
  3. A card is turned into a token by the payment provider.
  4. The order is created. Paid at once, the shopper goes to the page data-next-go names. 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:

WhatForgottenThe shopper sees
Security code (CVV)3 minutes after its last digitIts field asks for it again (payment.card.cvv.errors.cleared)
The whole card1 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 happenedThe shopper sees
The card is declinedThe reason in checkout.errors.payment (payment.errors.<code>, see Language); the cart is kept
Not paid at the providerThe checkout again with ?payment_failed=true and the same cart
Back from the provider without payingThe checkout as it was; paying again places a new order

Events for each case: Payment lifecycle.