Checkout for Standalone Payments

A standalone payment is a one-time payment for a specific amount. Standalone payments are not part of a Payment Request or a recurring payment plan.

If you want to create a single payment as part of a Payment Requests you need to use either the Dashboard, Payment Request Links or the Flywire API.

Sample Configurations for Payments

The following parameters must be specified as a minimum to successfully render the Checkout Experience form.

In the form, the payer enters their payer data and - if your portal uses custom fields - the custom field information.

Basic Settings

Payment Settings

Validation Settings

Flywire recommends that you always implement an onInvalidInput handler to report any error messages to your payers. For details see Checkout for Standalone Payments.

Form Settings

There are two input pages for collecting information that are displayed to the payer in the Checkout Experience form before they choose their preferred payment method:

  • Payer information

  • Custom information for the recipient

Specifying which pages will be shown:

The default for both parameters is false, which means omitting the parameters means the pages will not be displayed. If you are not submitting the full information yourself or want the payer to verify it, you have to set the parameters to true.

After-Payment Settings

var config = {
  // Set the target environment (demo, prod)
  env: "demo",

  // Set your unique code (may differ between demo and prod)
  recipientCode: "Your Portal Code",

  // Set the amount of the payment to be processed
  amount: 1234.56,

  // Recommended (not required) validation error handler
  onInvalidInput: function(errors) {
    errors.forEach(function(error) {
      alert(error.msg);
    });
  },

  // Display payer and custom field input boxes
  requestPayerInfo: true,
  requestRecipientInfo: true,

  // Set the return URL where payers are redirected to on completion
  returnUrl: "https://httpbin.org/get",
};		
				

There are two input pages for collecting information that are displayed to the payer in the Checkout Experience form before they choose their preferred payment method:

  • Payer information

  • Custom information for the recipient

This sample configuration will render a Checkout Experience form that can handle partial and complete pre-filling of information:

  • If the information has only partially pre-filled by you, the page will be displayed.

  • If the information has been fully provided by you, the page will be skipped.

Once the payment is complete the onCompleteCallback handler will be called and the checkout closed rather than the window being redirected.

 

Basic Settings

Payment Settings

Validation Settings

Flywire recommends that you always implement an onInvalidInput handler to report any error messages to your payers. For details see Checkout for Standalone Payments.

Form Settings

There are two input pages for collecting information that are displayed to the payer in the Checkout Experience form before they choose their preferred payment method:

  • Payer information

  • Custom information for the recipient

Specifying which pages will be shown:

The default for both parameters is false, which means omitting the parameters means the pages will not be displayed. If you are not submitting the full information yourself or want the payer to verify it, you have to set the parameters to true.

Skipping completed pages:

Pre-filling Payer and Recipient Information

Payer Information

Recipient Information

recipientFields object

A recipient (portal) can have various custom fields. You define those fields when you set up your portal together with Flywire.

Custom fields can be mandatory or optional. All mandatory fields need to be filled out in order to create a payment.

The custom fields vary by portal - please check your specific portal configuration to view your available fields.

When you are pre-filling custom fields and want to leave some fields empty, you can either pass them and set their value to null or you can just omit the field.

After-Payment Settings

onCompleteCallback object

A JavaScript callback function that is executed once the payment is completed and the modal has closed.

The payer stays on the original page. You specify an onCompleteCallback function in the Checkout configuration that handles the parameters containing payment information. The parameters are returned as a JSON args object to the callback handler.

It depends on the type of payment which parameters are returned, see Parameters returned via returnUrl or onCompleteCallback handler.

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

  onInvalidInput: function(errors) {
    errors.forEach(function(error) {
      alert(error.msg);
    });
  },

  // Display the payer and custom information input boxes
  // skipping either page if all the information has been passed in.
  // NB. You can see this behavior by completing the address, city and
  // country parameters in the next block.
  requestPayerInfo: true,
  requestRecipientInfo: true,
  skipCompletedSteps: true,

  // Pass in partial payer information (missing parameters can
  // alternatively be omitted rather than included with empty or
  // null values)
  firstName: "John",
  lastName: "Doe",
  email: "[email protected]",
  phone: "+44 1234 567 890",
  address: "",
  city: "",
  state: "",
  zip: "",
  country: null,

  // Pass in partial custom field information (missing parameters can
  // alternatively be omitted rather than included with empty or null
  // values)
  recipientFields: {
    booking_reference: "REF1234",
    additional_information: null,
  },

  // The callback function that is called once the payment is complete
  onCompleteCallback: function(args) {
    alert(args);
  },
};
			

There are two input pages for collecting information that are displayed to the payer in the Checkout Experience form before they choose their preferred payment method:

  • Payer information

  • Custom information for the recipient

This sample configuration will render a Checkout Experience form that hides both pages since you are providing all the information.

It is important to provide an onInvalidInput handler in this instance to ensure any validation errors are reported back to the payer.

In addition a nonce parameter can be set that is included in the generation of the sig parameter included in the returnUrl (and in the args supplied to the onCompleteCallback handler). Flywire recommends that you set this to a value that uniquely identifies an entity in your platform that this payment relates to - e.g. the same value as booking_reference in the sample below.

Basic Settings

Payment Settings

Validation Settings

Flywire recommends that you always implement an onInvalidInput handler to report any error messages to your payers. For details see Checkout for Standalone Payments.

Form Settings

There are two input pages for collecting information that are displayed to the payer in the Checkout Experience form before they choose their preferred payment method:

  • Payer information

  • Custom information for the recipient

Specifying which pages will be shown:

The default for both parameters is false, which means omitting the parameters means the pages will not be displayed. If you are not submitting the full information yourself or want the payer to verify it, you have to set the parameters to true.

Pre-filling Payer and Recipient Information

Payer Information

Recipient Information

recipientFields object

A recipient (portal) can have various custom fields. You define those fields when you set up your portal together with Flywire.

Custom fields can be mandatory or optional. All mandatory fields need to be filled out in order to create a payment.

The custom fields vary by portal - please check your specific portal configuration to view your available fields.

When you are pre-filling custom fields and want to leave some fields empty, you can either pass them and set their value to null or you can just omit the field.

After-Payment Settings

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

  // Highly recommended for this configuration
  onInvalidInput: function(errors) {
    errors.forEach(function(error) {
      alert(error.msg);
    });
  },

  // Hide the information input boxes
  requestPayerInfo: false,
  requestRecipientInfo: false,

  // Pass in complete payer information
  firstName: "John",
  lastName: "Doe",
  email: "[email protected]",
  phone: "+44 1234 567 890",
  address: "10, Downing St.",
  city: "London",
  state: "",
  zip: "SW1A",
  country: "GB",

  // Pass in complete custom field information
  recipientFields: {
    booking_reference: "REF1234",
    additional_information: "This is a sample",
  },

  // Supply a nonce to be included in the signature generation
  nonce: "REF1234",

  returnUrl: "https://httpbin.org/get",
};

This sample configuration renders the Checkout Experience form with settings for receiving callbacks for the payment.

Requirements for using callbacks

You must supply the following parameters for receiving callbacks:

If you want to receive callbacks, you must provide a callback URL and a callback ID, otherwise no callbacks will be triggered. You also must set the callback version to 2.

 

Basic Settings

Payment Settings

Validation Settings

Flywire recommends that you always implement an onInvalidInput handler to report any error messages to your payers. For details see Checkout for Standalone Payments.

Form Settings

There are two input pages for collecting information that are displayed to the payer in the Checkout Experience form before they choose their preferred payment method:

  • Payer information

  • Custom information for the recipient

Specifying which pages will be shown:

The default for both parameters is false, which means omitting the parameters means the pages will not be displayed. If you are not submitting the full information yourself or want the payer to verify it, you have to set the parameters to true.

After-Payment Settings

Callback Settings

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

  onInvalidInput: function(errors) {
    errors.forEach(function(error) {
      alert(error.msg);
    });
  },

  requestPayerInfo: true,
  requestRecipientInfo: true,

  returnUrl: "https://httpbin.org/get",

  // Enable payment status notification callbacks
  callbackId: "REF1234",
  callbackUrl: "https://api.yourdomain.com/flywire-notifications",
  callbackVersion: "2"
};

This configuration shows typical parameters with the following features:

  • setting some fields to read only so that the payer can see them but not edit their content

  • a custom sort order for payment options

  • setting up callback notifications

  • secure, verifiable signature generation

 

Basic Settings

Payment Settings

paymentOptionsConfig object

Contains optional configurations for the payment options displayed in the Checkout form.

sort array

Flywire makes every effort to display the payment option to payers in the most appropriate order based on payer behavior. You may prefer to change this order to better suit your and your payers needs. You can define the order in which payment options are shown to your payer based on payment currency, payment price (amount), and payment method (type).

The order in which currency , amount , and type are set in the sort array affects the final sort order.

Validation Settings

Flywire recommends that you always implement an onInvalidInput handler to report any error messages to your payers. For details see Checkout for Standalone Payments.

Form Settings

There are two input pages for collecting information that are displayed to the payer in the Checkout Experience form before they choose their preferred payment method:

  • Payer information

  • Custom information for the recipient

Specifying which pages will be shown:

The default for both parameters is false, which means omitting the parameters means the pages will not be displayed. If you are not submitting the full information yourself or want the payer to verify it, you have to set the parameters to true.

Skipping completed pages:

Pre-filling Payer and Recipient Information

Payer Information

Recipient Information

readonlyFields array (string)

You can set any of the input fields (for both the payer information and the custom fields) to read only with the readonlyFields array. This way you can ensure that the payer can't overwrite your pre-filled field values.

  • If you do not use this parameter, all fields will be editable.

  • If you use this parameter, any field passed here will be read-only. Any field not passed will still be editable.

recipientFields object

A recipient (portal) can have various custom fields. You define those fields when you set up your portal together with Flywire.

Custom fields can be mandatory or optional. All mandatory fields need to be filled out in order to create a payment.

The custom fields vary by portal - please check your specific portal configuration to view your available fields.

When you are pre-filling custom fields and want to leave some fields empty, you can either pass them and set their value to null or you can just omit the field.

After-Payment Settings

var config = {
  env: "demo",
  recipientCode: "Your Portal Code",
  amount: 1234.56,
							
  // Show the cheapest local payment option first but prefer bank transfers
  // over cards and online methods if they are the same price
  paymentOptionsConfig: {
    sort: [
      { currency: ["local", "foreign"] },
      { amount: "asc" },
      { type: ["bank_transfer", "credit_card", "online"] },
    ],							
  },
							
  onInvalidInput: function(errors) {
    errors.forEach(function(error) {
      alert(error.msg);
    });
  },

  requestPayerInfo: true,
  requestRecipientInfo: true,
  skipCompletedSteps: true,


  firstName: "John",
  lastName: "Doe",
  email: "[email protected]",
  phone: "+44 1234 567 890",
  address: "10, Downing St.",
  city: "London",
  state: "",
  zip: "SW1A",
  country: "GB",

  // Set any custom fields to read-only to prevent payers changing values
  // (in this configuration 'additional_information' will be editable)
  readonlyFields: ["booking_reference", "client_id"],							
							
  recipientFields: {
    booking_reference: "REF1234",
    client_id: "CLI1234",
    additional_information: null,
  },

  nonce: "REF1234",
  returnUrl: "https://httpbin.org/get",

  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 either via the returnUrl or the onCompleteCallback handler.

Example for response via returnUrl:

(Click to see the return URL in JSON formatting. For a detailed description of the parameters see the response via onCompleteCallback handler below.)

http://httpbin.org/get?reference=FLY123567890&status=success&amount=1234.56&payment_method=online&_=REF1234&sig=abcdefgh

Example for response via onCompleteCallback handler:

{
    status: "success",   
    amount: "1234.56",
    paymentMethod: "bank_transfer",
	bankTransferDueDate: "2024-05-27T14:54:57Z"
	reference: "FLY1234567890",
    _: "REF1234",
    sig: "abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
}