Skip to main content

Card tokenization & 3DS

Time: ~20 minutes | Difficulty: Intermediate | Type: part of Examples
Finished project: core-js-tokenization. Clone it if you want the working demo first — or keep reading to understand each hop of the flow.
This is the “you already have the order” path: your cart lives in Medusa, WooCommerce, or your own order API, and TagadaPay only tokenizes and charges. The demo walks the entire flow with a UI that narrates every step — tokenize, create the instrument, detect SCA, run the 3DS challenge in a modal, charge, retry.
If TagadaPay should manage the cart, upsells, and funnel, this is the wrong page — use the Headless SDK instead. Two minutes on Choose how you accept payments settles it.

The flow — who runs what

The whole point of this example is the client / server split. Raw card data stays in the browser; your API key stays on the server. Four hops:
When the instrument requires Strong Customer Authentication, the demo creates a 3DS session server-side and runs the challenge client-side — a modal pops, the customer authenticates, and you charge with the session attached:
src/api/paymentBackend.ts in the demo is written to be copied to your server — every function is annotated with a Next.js Server Action and an Express route version. The demo calls them from the browser only so you can watch the flow in one page; in production those calls move behind your auth.

Run it

Open http://localhost:5173, paste a store id, and use a sandbox test card. The right-hand sidebar keeps a history of tokens and store ids in localStorage so you can replay flows quickly, and a failed 3DS can be retried from the beginning.

The minimal variant

core-js-card-payment is the same flow with everything non-essential removed: one page, one card form, one charge, plus a /return route that shows how to resume after a processor redirect. Read core-js-tokenization to learn; copy core-js-card-payment when you just want the skeleton.

Next

Finished project on GitHub

Clone core-js-tokenization and watch every hop in the UI

Apple Pay & Google Pay

Same charge path, wallet buttons instead of a card form

core-js reference

The full API this demo is built on — every endpoint, every field

Sandbox testing

Test cards, forced 3DS, simulated declines