React Integration
Overview
The CrissCross wallets SDK renders Apple Pay and Google Pay buttons inside your own checkout, on your own domain, while CrissCross keeps the wallet plumbing: merchant validation, token decryption, 3-D Secure, and the transaction itself.
The SDK is initialised with a sessionId and nothing else. CrissCross resolves the wallet identifiers, the accepted card networks and the merchant display name for that session on the server, exactly as it does for Secure Fields.
There is no API key in your front-end bundle. Your OAuth client_id and client_secret are server-side credentials and must never reach the browser — the SDK does not accept them and does not need them. A sessionId authorises exactly one checkout and nothing else.
Pre-requisites
- Apple Pay and Google Pay enabled on your account.
- Your payment domains registered and verified. See Wallet Configuration.
- A checkout session created server-side. Create it with
integrationType: "direct", since you are rendering the checkout yourself.
Installation
Creating the session
Create the session from your server, as you would for any CrissCross payment, and pass the sessionId to your front-end. Never create sessions from the browser — session creation uses your OAuth credentials.
Rendering the buttons
Wrap your checkout in <CrissCrossWallets> and drop in the buttons you want to offer. The provider resolves the session’s wallet configuration; each button renders only if the customer’s device and browser can present that wallet and a card is provisioned.
A button that cannot be presented renders nothing at all — it does not render disabled. Lay out your checkout so that an absent wallet button leaves no gap, and always offer at least one other payment method.
Knowing what is available before you render
To branch on availability yourself — to choose a heading, or to reorder your payment options — use the useWallets hook:
available combines two things: what the session permits, from GET /v1/payment/available-methods, and what the customer’s device can actually present. Only wallets satisfying both appear.
What happens when the customer pays
- The customer taps the button and the wallet sheet opens on their device.
- They authorise with Face ID, Touch ID, a passcode, or a screen lock.
- The device releases an encrypted, single-use payment token, which the SDK submits to CrissCross. For Apple Pay the SDK also completes the merchant validation round trip; you do not implement it.
- If 3-D Secure is required, the SDK presents the challenge and resolves it before returning. Most wallet payments are exempt, because the device authentication already satisfies strong customer authentication.
onSuccessfires with thetransactionId.
A customer who dismisses the wallet sheet without authorising produces no transaction and no callback. Leave your checkout as it was.
Confirm on the webhook, not on the callback
onSuccess tells you the wallet authorised and CrissCross accepted the payment. It is a display signal, exactly like the hosted checkout’s ?status=completed redirect. Show a confirmation from it — but fulfil the order from the webhook, which is the authoritative outcome and arrives even if the customer closes the tab. See Webhook Events.
Match the webhook to your order on sessionId or merchantReference.
Handling errors
onError receives a failure that has already been resolved as far as it can be:
Do not retry automatically. A declined wallet payment usually needs the customer to pick a different card in the wallet sheet.
Vanilla JavaScript
The same functionality is available without React for other frameworks:
Additional resources
- Wallet Configuration — registering the domains this SDK renders on.
- Server Integration — submitting the wallet token from your own server instead.
- Digital Wallets — supported workflows, refunds and reconciliation.
- Webhook Events — the authoritative payment outcome.