Skip to navigation

Headless Cards

Embed a card payment form in your own interface without routing users through the Transak widget.
View as Markdown

Headless Cards is a lightweight, embeddable UI module that allows partners to offer credit/debit card payments directly within their own application without loading any widget.

Our Solution

Headless Cards exposes just the card payment form as a standalone, embeddable component. Partners control where it sits, how it looks, and what happens after payment. Transak handles all the payment infrastructure in the background.

Here are some of the key benefits of the Headless Cards solution:

Just the card form

Embed only the card payment form — no full widget required.

Fewer steps to payment

Users see the card form immediately within the partner UI, reducing drop-off.

Seamless checkout integration

The card form sits inside the partner’s own checkout UI, keeping the experience continuous.

Full partner control

Partners decide where the form appears, how it looks, and what happens after payment.

How does it work?

Headless Cards

Current Limitations

LimitationDetails
Headless Cards APIs
(Transaction Session API, Create Order (with New Card) API, Get Saved Cards API, Create Order (with Saved Card) API, Delete Saved Cards API, Transaction Request Status API)

APIs are to be called only from the partner backend and subjected to the whitelisting of partner IP addresses. We don’t support API calls from the frontend due to security restrictions.

Supported for JS, React, and React Native integrations

The Transak UI SDK is available for JS, React, and React Native integrations.

Card payment availability

Card payments are only supported if the Get Fiat Currencies API response includes payment method credit_debit_card for that particular fiat currency.

How to integrate?

1

Whitelist Your API Key & Enable Headless Cards

Action
Follow the steps in the Need help in Integration section
Request API key whitelisting and ask to enable Headless Cards for your API key
Share your public IP addresses with Transak for whitelisting to use our APIs in your backend
2

User Authentication

You can use either of the following authentication options:

OptionDescription
White-label AuthUse the standard Transak authentication flow to generate a user access token. Partners can do this by calling the Send User OTP API followed by the Verify User API to generate the access token.

Learn more
Auth RelianceUse Auth Reliance by passing these headers with every request: x-user-identifier and x-access-token

Please refer to the tutorial on how to create partner access token.

3

User KYC

KYC is a mandatory step in compliance with regulatory requirements. Each user should be KYC Approved. You can use either of the following KYC options:

OptionDescription
White label KYCPartners can collect the required KYC information on their end and then forward it to Transak for review and approval. Learn more: Whitelabel KYC
KYC Reliance via SumsubPartners can share their KYC data from their platform with Transak using Sumsub. Learn more: KYC Reliance Guide
4

Generate a quote using the Quote API

Call the Get Quote API to get a quote for the transaction. Pass the apiKey, fiat amount, fiat currency, crypto currency, network, and order type.

Set paymentMethod to credit_debit_card while creating a quote.

A successful response returns a quoteId.

5

Check for saved cards (using Backend only)

Call the Get Saved Cards API to check whether the user has any previously saved credit/debit cards. A successful response returns a cards array.

CaseNext step
No saved cardsGo to Create a transaction session to let the user add a new card
Saved card(s) foundGo to Place order using the saved card
6

Place order using the saved card (using Backend only)

If the user picks one of the saved cards, call the Create Order (with Saved Card) API from your backend using the quoteId, walletAddress, and the selected card’s paymentIdentifierId.

ParameterDescription
quoteIdQuote ID returned by the Get Quote API
paymentInstrumentIdAlways credit_debit_card
walletAddressThe user’s wallet address for the selected cryptocurrency and network
paymentIdentifierIdThe saved card’s identifier returned by the Get Saved Cards API
additionalDatasuccessUrl and failureUrl to redirect the user after the payment

A successful response returns the full order details with redirectUrl. Continue with the Open the redirectUrl in a browser or WebView step below.

7

Create a transaction session (using Backend only)

Call the Transaction Session API from your backend using the quoteId, successUrl, failureUrl and the user’s wallet address. You can optionally pass a config and billingAddress object to customise the look and feel of the card component and billing details.

ParameterDescription
quoteIdQuote ID returned by the Get Quote API in the previous step
walletAddressThe user’s wallet address for the selected cryptocurrency and network
successUrlURL or deep link to redirect the user to when the transaction completes successfully
failureUrlURL or deep link to redirect the user to when the transaction fails or is cancelled

A successful response returns a sessionId.

8

Load the Card Component via Transak UI SDK

Use the Transak UI SDK to render the card payment component. Pass the sessionId received in the previous step.

npm install @transak/ui-components
import { createTransakCard } from '@transak/ui-components';
const card = createTransakCard({
sessionId, // sessionId from previous step
environment, // 'STAGING' | 'PRODUCTION'
onReady: () => {
// Component is ready
},
onChange: ({ isValid, errorCode }) => {
// Fires on form-state changes
},
onSuccess: ({ requestId }) => {
// Payment data captured — use requestId in the next step
},
onError: ({ code }) => {
// Handle error
},
});
await card.mount('checkout-slot');
// Call submit() when the user clicks on submit button
document.getElementById('submit-btn')
.addEventListener('click', () => card.submit());

Call card.unmount() to remove the component from the page after onSuccess fires, or when the user leaves the checkout screen.

onChange callback

The onChange callback fires repeatedly as the user types and receives isValid and an optional errorCode:

CodeDescription
CARD_INVALIDThe card details entered are invalid
BIN_BLOCKEDThe card’s BIN is blocked and can’t be used

onError callback

The onError callback returns one of the following error codes. Use it to handle each failure case.

CodeDescription
CONFIG_LOAD_FAILEDCard configuration could not be loaded
PAYMENT_CAPTURE_FAILEDCard payment capture failed
INVALID_OPTIONSInvalid or missing options passed to the SDK
IFRAME_LOAD_FAILEDThe embedded iframe failed to load
INVALID_STATESDK method called in an unexpected state
9

Place order using the new card (using Backend only)

Once the SDK fires onSuccess with a requestId, call the Create Order (with New Card) API from your backend using the requestId to complete the payment and create the order.

A successful response returns the full order details with redirectUrl. Continue with the Open the redirectUrl in a browser or WebView step below.

10

Track the requestId (using Backend only)

Call the Transaction Request Status API to check whether the request has been processed. Poll this endpoint until the status reaches a terminal state.

Once you receive an orderId, use the Get Order by ID API to fetch full order details, which will contain the redirectUrl.

11

Open the redirectUrl in a browser or WebView

Always open the redirectUrl returned in the previous step in a browser or WebView.

ScenarioWhat happens on the redirectUrl page
Authentication requiredUser completes 3DS or bank verification and is then redirected to successUrl or failureUrl
No authentication requiredRedirects directly to successUrl or failureUrl

Upon completing the transaction, the user is redirected based on the payment status:

OutcomeRedirect destination
Payment successfulsuccessUrl passed in Transaction Session API (for New Card) or Create Order API (with Saved Card)
Payment failedfailureUrl passed in Transaction Session API (for New Card) or Create Order API (with Saved Card)

API Overview

API Errors

Status CodeError CodeMessageNext StepTerminal State
4006099successUrl and failureUrl are required for credit/debit card payments.Pass successUrl and failureUrl in the Transaction Session API request, then retry.No
4011002Invalid or missing authentication token.Pass a valid authorization header, or x-user-identifier and x-access-token headers for Auth Reliance, then retry creating the session.No
4226002KYC is not approved. Please complete KYC before creating a session.Check the KYC status using Get KYC Requirement. If it is not APPROVED, complete KYC before retrying.No
4226003This feature is not enabled for your account. Please contact support.Contact Transak to enable Headless Cards for your account.Yes
4226005Quote not found or could not be loaded.Get a new quote with Get Quote, then retry creating the session.No
4226005This payment method is not currently supported. Please try a different payment method.Get a new quote with paymentMethod = credit_debit_card using Get Quote, then retry creating the session.No
4226006The provided wallet address is invalid for the selected cryptocurrency and network.Validate the address with Verify Wallet Address, then retry creating the session.No
4002030Your account has been disabled. Please get in touch with us at fraud@transak.com.Ask the user to contact fraud@transak.com.Yes
5006005Failed to create a session for the user.Retry creating the session after a few seconds.No
Status CodeError CodeMessageNext StepTerminal State
4046007Request ID not found.Retry placing the order with a new requestId.Yes
4094005Order exists.Cancel the active order using Get Active Orders → Cancel Order, then retry placing the order.No
4224001Invalid wallet address. Please provide a valid wallet address to proceed.Validate the address with Verify Wallet Address, then retry placing the order.No
4224003Please upgrade your kyc to next level to proceed with this transaction.Check the KYC requirements using Get KYC Requirement, complete KYC, then retry placing the order.No
4224013Minimum amount should be more than {amount}.Get a new quote above the minimum amount with Get Quote, then retry placing the order.No
4224015Invalid payment method for currency combination.Pick a supported currency from Get Fiat Currencies and get a new quote with Get Quote, then retry placing the order.No
4224016FCA criteria not met, Please complete the assessments.Complete the FCA assessments, then retry placing the order.No
4226012KYC requirement is not approved for this transaction.Check the KYC status using Get KYC Requirement. If it is not APPROVED, complete KYC before retrying the order.No
4226014Unable to process request. User location data is required for this transaction.Pass the end user’s IP address in the x-user-ip header of Transaction Session API, then retry placing the order.No
4002030Your account has been disabled. Please get in touch with us at fraud@transak.com.Ask the user to contact fraud@transak.com.Yes
5004021Something went wrong, try again later!Retry placing the order after a few seconds.Yes
5006099Unable to process the order. Please try again.Retry placing the order after a few seconds.Yes
Status CodeError CodeMessageNext StepTerminal State
4046007Request ID not found.Retry placing the order with a new requestId.Yes
4094005Order exists.Cancel the active order using Get Active Orders → Cancel Order, then retry placing the order.No
4224001Invalid wallet address. Please provide a valid wallet address to proceed.Validate the address with Verify Wallet Address, then retry placing the order.No
4224003Please upgrade your kyc to next level to proceed with this transaction.Check the KYC requirements using Get KYC Requirement, complete KYC, then retry placing the order.No
4224013Minimum amount should be more than {amount}.Get a new quote above the minimum amount with Get Quote, then retry placing the order.No
4224015Invalid payment method for currency combination.Pick a supported currency from Get Fiat Currencies and get a new quote with Get Quote, then retry placing the order.No
4224016FCA criteria not met, Please complete the assessments.Complete the FCA assessments, then retry placing the order.No
4226011KYC requirement is not approved for this transaction.Check the KYC status using Get KYC Requirement. If it is not APPROVED, complete KYC before retrying the order.No
4226014Unable to process request. User location data is required for this transaction.Pass the end user’s IP address in the x-user-ip header of Transaction Session API, then retry placing the order.No
5004006Unable to create order.Retry placing the order after a few seconds.No
5004021Something went wrong, try again later!Retry placing the order after a few seconds.Yes
5006099Unable to process the order. Please try again.Retry placing the order after a few seconds.Yes

Interactive Demo