Testing One Off Payments
Testing Payment Notifications for One Off Payments
You can test creating One Off Payments with different payment methods.
1. Choose the recipient for the test payment.

The list of recipients contains all the recipients that are available to you as a client. You can display this list in your UI, for example as a drop down, so that the person creating the payment in your system can choose one of the recipients.
Parameters for the Request Body
No request body is needed.
Optional Query Parameters for Pagination
This endpoint supports pagination. If you are not providing any pagination parameters, the response is returned with default pagination settings.
Pagination parameters are added as query parameters with the request in the format
{endpoint_path}?page=2&per_page=10

The default setting is:
-
page=1 (start on page 1)
-
per_page=10 (display 10 entries per page)

Enables you to access a specific page of the results.
Possible values: Any positive number except zero.

Enables you to define how many results will be included per page.
Possible values: min 1
, max 100
curl https://base-url-placeholder/recipients?page=1&per_page=100
-X GET
-H "Content-Type: application/json"
-H "X-Authentication-Key: {api_key}"
2. Create a Checkout Session.

Parameters for the Request Body

The type of the Checkout Session. Must be one_off for One Off Payments.
charge_intent object

Must be one_off for One Off Payments.
payor object
You have the option to pass payer information to pre-fill the fields of the UI form.
For a description of all fields and their valid values form see:
-
Payment Element if you are using Flywire Elements
-
Checkout Experience if you are using Checkout

Before pre-filling the payer fields, consider your use case and who the actual payer will be. The UI forms collect the card holder or bank account owner information. There can be cases when this person is different from the payer in your system.
For example, if you are a school and your system stores information about a student, you consider the student as the “payer”. But the person who actually pays could be the student’s parent. In this case, it would not make sense to pre-fill the fields with the student’s information, since the card holder is a different person. On the other hand, the payer can always edit the fields in the UI form, which means even if you are pre-filling the fields with the wrong details the payer can always correct them.
In order to create the best payment experience for your payers, consider which information you store in your system and how useful it is for them when fields are already filled out.
options object
Contains settings for the UI form.
form object

The language you want to translate the form to. The localization affects the labels of the form fields and the action button.
The default is English (“en”).

Language | Value for locale |
---|---|
English | en |
Spanish | es-ES |
Chinese | zh-CN |
Korean | ko |
Portuguese | pt-PT |
Japanese | ja |
French | fr-FR |
Bahasa Indonesia | id |
Arabic | ar |
Vietnamese | vi |
Italian | it-IT |
German | de-DE |

The show_payor_information parameter gives you the option to skip the payer information page of the form. This shortens the time your payer has to interact with the form if you already provided all the necessary information. If you skip the page, the page for selecting the payment method is shown immediately.
If you don't provide the parameter, the payer information page is shown by default.
Note:
-
If you want to skip the page, all mandatory payer information fields must be pre-filled by you.
-
If field values are missing or are invalid, the payer information page will be displayed so that the payer can add or correct the information.
Possible values:
-
true default, payer information page is displayed
-
false payer information page is not displayed, page for selecting the payment method is shown immediately
recipient object
Contains the fields of the recipient.
fields array
It depends on the recipient which fields are optional or required. If a field is required, you must provide it here. Optional fields can be left out.

You can check which fields are required for a recipient with this request (replace {recipientId} with the recipient ID):
Required fields have the required parameter set to true. For more info see Getting Details about a Recipient.

Identifier of the field.

The value for this field.
items array

An item is something that your payer can pay for (for example: tuition fees, housing, etc.). When you create a payment, you display the items to your payer and they can choose for which items they want to pay. How many items there are depends on the recipient's configuration.

You can only use one item in this request. The id
of the item must be called default
.

Identifier of the item.
You can only use one item in this request. The id
of the item must be called default
.

The amount for this item in the billing currency,

The billing currency is the currency in which the recipient of the payment is billing their payer. The billing currency depends on the
The amount is specified in the smallest unit of the currency, called subunits. For example, in USD, the subunit is cents, and 100 cents equal 1 USD. So, an amount of 12025 (cents) is equivalent to 120.25 USD.
Note that the subunit-to-unit ratio varies by currency, it is not always 100. See Currencies for the subunits of each currency.

The notifications URL enables you to receive callbacks about the payment status (see Payment Status Notifications).
The notifications URL is the dynamic URL for receiving callbacks.

There are two different URLs for receiving callbacks:
Static URL
For API integrations:
When you set up your application that accesses the Flywire API, you had the option to define a notifications URL. This is the static notifications URL. Callbacks will be sent to this URL for all payments you created via the Flywire API.
The recipient of a payment may also have a static notifications URL defined which might be different from your static notifications URL as a client. In that case, callbacks will also be sent to the recipient's notifications URL.For other integrations:
When you set up your portal together with Flywire, you had the option to define a callback URL for that portal. Callbacks will be sent to this URL for all payments for this portal.
If you don't use a static callback URL yet and want to start using it, please contact the Solutions team.
Dynamic URL
The URL you can set in a parameter when you are creating a payment is the dynamic notifications URL. Since this URL can be different for every payment you create, it is called dynamic.
How defining static and dynamic URLs affect callbacks
![]() |
![]() |
Static URL |
Dynamic URL |
Result |
![]() |
![]() |
You won't receive notifications. |
![]() |
![]() |
You'll receive notifications to your static URL. |
![]() |
![]() |
For API integrations: The dynamic URL will override the static URL and you'll receive notifications only to the dynamic URL. For other integrations: You'll receive callbacks to both URLs. This is called "dual callback URL". A dual callback URL means you defined a static URL in your portal and you are sending callbacks to a different callback URL via the parameter for the payment. In this case, callbacks will be sent to both URLs. This
approach can be useful if you want to update two separate systems.
|
![]() |
![]() |
You'll receive notifications to your dynamic URL |

The external reference.
The external reference is used to match a notification to a particular payment. You can use any kind of identifier or reference from your own system you might need to identify the payment.

The recipient ID.
The recipient ID is the unique three-letter ID that identifies the recipient, for example FWU for Flywire University. The recipient ID has been assigned by Flywire when the recipient has been set up.

You can use this request to get a list of all recipients that are available to you as a client and what their recipient ID is:
For details see Getting a List of all available Recipients.

The payor_id depends on how you want to uniquely identify a payer. Usually, you use an ID from another system, for example your ERP. Spaces are not allowed.

With this parameter you can decide if you want to send the emails to your payer yourself or if you want Flywire to automatically send the emails for you:
-
true: Flywire sends the emails for you
-
false: You send the emails yourself
Default: false
Refer to One Off Payments: Emails to Your Payer for which emails need to be send for One Off Payments.
Mandatory emails
If you use the default setting false, you have to send the mandatory emails to your payer yourself, see One Off Payments: Emails to Your Payer.
curl https://base-url-placeholder/checkout/sessions
-X POST
-H "Content-Type: application/json"
-H "X-Authentication-Key: {api_key}"
-d '{
"type": "one_off",
"charge_intent": {
"mode": "one_off"
},
"payor": {
"first_name": "Peter",
"last_name": "Payer",
"address": "123 High Street",
"city": "London",
"country": "GB",
"state": "",
"phone": "0044123456789",
"email": "[email protected]",
"zip": "SW1A 1AA"
},
"options": {
"form": {
"locale": "en"
"show_payor_information": true
}
},
"recipient": {
"fields": [
{
"id": "custom_field_1",
"value": "ID12345"
},
{
"id": "custom_field_2",
"value": "2020"
}
]
},
"items": [
{
"id": "default",
"amount": 33000
}
],
"notifications_url": "https://webhook.site/9bf9cf8d-1d8c-46d1-b147-ca5841ff2ede",
"external_reference": "My payment reference",
"recipient_id": "TQQ",
"payor_id": "my_payer_ID",
"enable_email_notifications": true
}
You'll receive a URL for the UI form in the API response.
3. Open the URL for the form in your browser.
4. In your browser, add the event listener code to the page.

Open the developer tools for your browser and add the following event listener code via the console. |
|
5. Fill out the payer info fields in the One Off Payments form and click "next".
The fields do not affect the test scenario, you can fill them with any data you want.
6. Select the payment method.
The next steps depend on the chosen payment method. Which scenarios you can test also depends on the payment method:
- Cards (Debit or credit)
- SEPA Direct Debit
-
Enter magic values as the card holder’s first and last name depending on which scenario you want to test:
Scenario First Name Last Name "Happy path", meaning no errors. 3DS will be triggered.
The payment will successfully be charged.
MAGICVALUE AUTH "Happy path", meaning no errors. 3DS will not be triggered.
The payment will successfully be charged.
MAGICVALUE APPROVED Credit card is expired.
Payments that try to use this card will not be charged successfully.
MAGICVALUE CARD EXPIRED Credit card is declined because of fraud suspicion.
Payments that try to use this card will not be charged successfully.
MAGICVALUE FRAUD Credit card doesn't have enough balance and can't be charged for this payment.
Payments that try to use this card will not be charged successfully.
MAGICVALUE NOT ENOUGH BALANCE -
Use one of the demo credit cards for the credit card details:
Brand Number Expiration date CVV Visa 4111 1111 1111 1111 03/30 737 Mastercard 5454 5454 5454 5454 03/30 737 Amex 3700 0000 0000 002 03/30 7373
After you selected this payment method, enter the following values:
Country |
Spain |
Account Holder Name |
MAGICVALUE APPROVED |
Any fake email address | |
IBAN |
ES7921000813610123456789 |
7. Send the form.
If you used a scenario that triggers 3DS authentication, you now see the Flywire 3DS authentication simulator. Enter the word password in the password field and click on continue to complete the authentication. |
8. Check the notifications.
The payment is now created according to your scenario. You'll receive the following notifications:
- For "Success" Scenarios
- For "Failed" Scenarios
Within the next 30 seconds:
Initiated
This is the end of this scenario.
Within the next 1 minute:
Initiated
Cancelled (immediately after initiated)
This is the end of this scenario.