Use Case: Pre-Authorization Payments

What are Pre-Authorization Payments?

A Pre-Authorization Payment temporary reserves the payment amount on a debit or credit card. The purpose of a pre-authorization is to verify that the cardholder has sufficient credit available to cover a transaction and to temporarily set aside that amount until you capture the funds.

Pre-Authorization Payments are only available for same-currency payments, not for FX payments.

Example for a Pre-Authorization Payment:

A guest checks into a hotel for a three-night stay, and you place a pre-authorization on their credit card for the estimated cost of the stay.

  1. Check-In: You pre-authorizes $600 on the guest's credit card ($150 per night plus $150 deposit). This reduces the guest's available credit by $600 but is not yet charged.

  2. During the Stay: The guest orders room service for $50.

  3. Check-Out: The final bill is $500 ($450 for room charges plus $50 for room service). You capture $500 from the pre-authorization. The remaining $100 from the original hold is returned to the guest's available credit.

A Pre-Authorization Payment is split into two distinct steps:

  1. Pre-authorization of funds

    This step reserves the funds on the card for a certain amount of time (the holding period). The funds are reserved but not withdrawn.

  2. Capturing the funds

    When the funds are captured, the card is charged and funds are withdrawn. You can manually capture funds anytime during the holding period. If you decide not to capture the funds you can cancel a Pre-Authorization Payment anytime during the holding period.

Walkthrough: Pre-Authorization Payments

To be able to use the Flywire API, you need to be registered, and all requests to the Flywire API need to be authenticated, see Flywire API Basics

If you are just getting started and only have Sandbox credentials, you need to use the Sandbox environment. All request examples let you switch between the production and sandbox base URL.

  1. Implement a trigger on your website that sends an http request to your backend.

    The trigger could be a button like "Make Payment". The http request tells your backend to send a secure request to the Flywire API to create a Checkout Session.

  2. Create a Checkout Session via the API.

    From your backend, you can securely create a Checkout Session. You need to know which recipient you want to use for this request.

  3. Receive the URL for displaying the form.

    The response after creating Checkout Session will return a URL to you (as the value of the url parameter in the hosted_form object). This is the URL you need in order to display the UI form in an iframe on your website.

    When you are pre-filling the form, the response can contain warnings (in the warnings array) in case the pre-filling of any fields didn't pass the validation, see Field validation warnings after pre-filling a UI form for more details.

    You can decide which information from the response you want to filter out in your backend before passing the URL to your frontend.

  4. Display the form on your website.

    The form is where Flywire gathers the payer and payment information.

  5. After your payer filled out the form, a payment is created.

    This payment stays in initiated until you capture the funds (see last step).

  6. Receive the URL for confirming the Checkout Session.

    There are many ways for your backend to receive the confirm URL. One option is to directly send it from the event listener you implemented on your website to your backend.

  7. Confirm the Checkout Session via the API.

    After the payer filled out the form you need to confirm the session as a security measure.

  8. After you confirmed the session you receive the payment reference in the response.

  9. Capture the funds within the holding period. See Capturing the Funds for a Pre-Authorization Payment.

    Optionally, you can adjust the authorized amount during the holding period. See Adjusting the Amount for a Pre-Authorization Payment.

    If you decide to not take any payment before the holding period ends, you can cancel the payment. See Cancelling a Payment.