Add card-on-file using the External Card Creation Widget
This step is required if you are not PCI certified.
The External Card Creation Widget allows your customers to securely enter payment card information directly in your application. Since the widget communicates directly between the client and Synctera, it removes the need for you to be PCI certified. The information is stored securely and can be retrieved via Synctera API.
The External Card Creation Widget provides a complete, secure payment form that includes:
Card Number (PAN) - Primary account number with automatic formatting
Cardholder Name - Name on the card
Expiration Date - Card expiry with MM/YY format
CVV/CVC - Security code (3-4 digits)
Billing Address - Optional billing address fields
All sensitive card data is handled in isolated iframes, ensuring PCI compliance while giving you full control over the user experience.
Request a widget token for tokenizing cards from your backend using the Synctera API. The widget token is required for the widget to authenticate and submit card data.
Widget tokens expire after a set period and are scoped to a specific customer. Generate a new token on each page load or when needed.
Widget tokens are one use only, so if a user submits and gets an error that invalidates the token and the widget will be to be supplied a new token.
Dispatched when the widget fails to initialize. This means one or more secure input fields could not load, and the widget is not functional. Show an error message or retry UI to the user.
Property
Type
Description
instanceId
string
Unique ID for this widget instance
error
string
Human-readable error message (safe to display)
failedFields
string[]
List of field types that failed to load
Copy
Ask AI
<script> document.getElementById('card-widget').addEventListener('error', (event) => { const { error, failedFields } = event.detail; console.error('Widget initialization failed:', error, failedFields); // Show error UI or offer a retry button });</script>
The load and error events are mutually exclusive — exactly one will fire during widget initialization. Always listen for both to handle all scenarios.
The widget dispatches a success event when card tokenization is successful. The event detail contains external_card_id and message (sensitive card data is not returned):
Copy
Ask AI
<external-card-creation id="card-widget" token="your-token" env="sandbox"></external-card-creation><script> document.getElementById('card-widget').addEventListener('success', (event) => { console.log('Card tokenized successfully:', event.detail); const { external_card_id, message } = event.detail; // Use external_card_id for payments or to retrieve card via API });</script>
As an alternative to addEventListener, you can set callback functions directly on the element via JavaScript. These are JS-only properties and cannot be set as HTML attributes.
If you are PCI certified, you have the option to create the External Card directly using the card credentials by calling POST /v1/external_cards. In addition to the card credentials (pan and expiration_month/expiration_year), you must provide the customer_id and cardholder name (business_id may optionally be provided if applicable). cvv is optional (for migration purposes), but should be provided for adding new cards as it provides an additional layer of security and reduces the risk of fraud. A billing_address can be added optionally, if it is different from the cardholder’s address-on-file on the Synctera platform. For more details on CVV and address verification, see the Verifications section.
When an External Card is created, the following verifications are performed:
CVV2 verification:
CVV2 provided in the widget or in the API is validated against the CVV2 on file with the issuer
Address verification:
Unless billing address is specified in the widget/API, the address stored on the customer’s record on Synctera is validated against the address-on-file with the issuer
Note that if business_id is provided, address verification is performed on the Business’s legal address, otherwise, it is performed on the Person’s legal address. However, cardholder name matching is performed on the Person’s name regardless.
Name verification:
Name provided in the widget is validated against the name on file with the issuer
The verification results are displayed in the verifications object. In addition to CVV2, address and name, the verifications object contains information about the card, as well as the type of transactions the card supports. If either pull_enabled or push_enabled are false, that type of transaction may not be performed using the card.
Once a card has been added on file, a PULL or a PUSH payment can be initiated with the card. For PULL payments, 3-D Secure (3DS) authentication is required. For details on how to enable 3DS, and how to iniate a payment with a card-on-file, see the Instant Payments - Card-On-File section.