Checkout for Tokenization

Tokenization allows you to collect future payments with variable amounts whenever required.

Tokenization is a type of recurring payment that provides you with the greatest degree of control and flexibility over future payment processing.

Example:

"Store your card now and we will charge it whenever you use one of our services." 

Who handles future payment creation and emails to your payer?

You can create payments whenever required, payments will not be created automatically by Flywire. Since Flywire doesn't know when you are creating payments, you are also responsible for sending emails to your payer at the appropriate times.

See Tokenization: Emails to Your Payer.

image

Tokenization with Checkout means the card or bank account details get stored in Flywire's secure PCI compliant vault, and a commercial token is generated that you can use to charge the card or bank account.

  • For cards, only the commercial token is needed.

  • For bank accounts, a digitally signed PDF mandate is needed in addition to the token. The PDF mandate will be automatically generated and stored by Flywire. To create a new charge for the bank account, you only need the commercial token.

Ways to tokenize a card or bank account via Checkout

  1. Seed Payment Tokenization

    Initial payment: Yes
    Return of token:

    Token is returned if the card payment or the direct debit mandate submission is successful.

    For direct debits the payment will be submitted as soon as the mandate is successfully set up. You must use callbacks to automatically retrieve the status of the payment.

    Settings:
    amount Any value greater than zero.
    recurringType tokenization
  2. Zero-Value Tokenization

    Initial payment: No (only collect the payer's card details or completed direct debit mandate form)
    Return of token:

    Token is returned if it passes validation or submission.

    Settings:
    amount 0
    recurringType tokenization
  3. Optional After-Payment Tokenization

    Initial payment: Yes
    Return of token:

    After processing the initial payment successfully, the payer is asked if they want to save their card details. If the payer opts in, a token will be returned.

    Settings:
    amount

    Any value greater than zero.

    recurringType optional_tokenization

Configuration Example

Basic Settings

Tokenization Settings

recurringType string

Two possible options:

  • tokenization (for seed payments or zero-value tokenization)

  • optional_Tokenization (for optional tokenization)

Payment Settings

amount decimal

For zero-value tokenization: 0

For seed payment and optional tokenization: value greater than 0

paymentOptionsConfig array (string)

Allows you to control which payment methods are offered.

Possible values:

  • direct_debit

  • credit_card

Payer Info and Custom Info

Optionally pre-fill fields and decide which input pages will be shown. See Pre-filling Fields of the Form for details.

After-Payment Settings

For security reasons, the token is only returned via onCompleteCallback handler. The returnUrl does not return the token.

This means that when you are tokenizing, you must only use the onCompleteCallback handler.

See After-Payment Settings for details.

If you are using tokenization that creates an initial payment, you should provide settings for callbacks.

Using callbacks is optional, but highly recommended.

Callbacks give you important updates about the status of the payment. See Payment Status Notifications for details.

var config = {
  env: "demo",
  recipientCode: "Your Portal Code",

  //Mandatory tokenization before payment - "tokenization" or "optional_tokenization";
  recurringType: "tokenization",

  // >0 for Seed Payment and Optional Tokenization; 0 for Zero-Value Tokenization;
  amount: 100,	
									
  // Control which payment options are available for tokenization
  paymentOptionsConfig: {
        filters: {
            type: [ "credit_card", "direct_debit" ]
        }
    }

  // Other checkout parameters (e.g. pass payer info or set requestPayerInfo to true)
  firstName: "John",
  lastName: "Doe",
  requestPayerInfo: true,

  // Specify onCompleteCallback handler
  onCompleteCallback: function(args) {
    sendToBackend(args); // Replace with your function to send data to the backend
  },

  // Only if an initial payment is made
  callbackId: "REF1234",
  callbackUrl: "https://api.yourdomain.com/flywire-notifications",
  callbackVersion: "2"
};

After Payment Completion

Once a the payer has successfully entered their details and the Checkout Experience form is closed, you receive information about the payment via the onCompleteCallback handler.

For security reasons, the token is only returned via onCompleteCallback handler. The returnUrl does not return the token.

This means that when you are tokenizing, you must only use the onCompleteCallback handler.

If you choose optional tokenization and the customer did not opt in to save their card, the response parameters are the same as standalone payments, see Checkout for Standalone Payments - After Payment Completion.

Example for response via onCompleteCallback handler:

{
    "status": "success", 
    "amount": "123.45", 
    "payment_method": "recurring", 
    "reference": "FLY123456789", 
    "amountCurrency": "USD", 
    "payerAmount": "175", 
    "payerAmountCurrency": "EUR", 
    "digits": "5454", 
    "expirationMonth": "3", 
    "expirationYear": "2030", 
    "token": "ABCD1234"
}

Next Steps

Tracking payments

Once created, payments can be tracked via imageClient Dashboard, but you can't edit them. You can also track them via Payment Status Notifications.

Charging new payments

New payments can be charged via the API, see Creating a Payment with a Token.

The payments created with tokenization are standalone Standalone Payments, which means they are not part of a Payment Request.