---
title: "Create a redirect flow"
method: POST
path: "/redirect_flows"
tags: ["Redirect Flow"]
deprecated: true
---

# Create a redirect flow

`POST /redirect_flows`

## Request

- Base URL: `https://api.gocardless.com`
- URL: `https://api.gocardless.com/redirect_flows`
- Auth: HTTP bearer

> **Deprecated.**

Creates a redirect flow object which can then be used to redirect your customer to the GoCardless hosted payment pages.

**Deprecated:** Redirect Flows are legacy APIs and cannot be used by new integrators.
The [Billing Request flow](https://docs.gocardless.com/docs/api-reference/billing-request) API should be used for your payment flows.

## Headers

- `GoCardless-Version` string, required

## Request body

- object
  - `redirect_flows` object
    - `description` string, nullable: A description of the item the customer is paying for. This will be shown on the hosted payment pages.
    - `session_token` string, required: The customer's session ID must be provided when the redirect flow is set up and again when it is completed. This allows integrators to ensure that the user who was originally sent to the GoCardless payment pages is the one who has completed them.
    - `scheme` 'ach' | 'autogiro' | 'bacs' | 'becs' | 'becs_nz' | 'betalingsservice' | 'pad' | 'sepa_core', nullable: The Direct Debit scheme of the mandate. If specified, the payment pages will only allow the set-up of a mandate for the specified scheme. It is recommended that you leave this blank so the most appropriate scheme is picked based on the customer's bank account.
    - `success_redirect_url` string, required: The URL to redirect to upon successful mandate setup. You must use a URL beginning `https` in the live environment.
    - `prefilled_customer` object: Customer information used to prefill the payment page so your customer doesn't have to re-type details you already hold about them. It will be stored unvalidated and the customer will be able to review and amend it before completing the form.
      - `email` string, nullable: Customer's email address.
      - `given_name` string, nullable: Customer's first name.
      - `family_name` string, nullable: Customer's surname.
      - `company_name` string, nullable: Customer's company name. Company name should only be provided if `given_name` and `family_name` are null.
      - `address_line1` string, nullable: The first line of the customer's address.
      - `address_line2` string, nullable: The second line of the customer's address.
      - `address_line3` string, nullable: The third line of the customer's address.
      - `city` string, nullable: The city of the customer's address.
      - `region` string, nullable: The customer's address region, county or department.
      - `postal_code` string, nullable: The customer's postal code.
      - `country_code` string, nullable: [ISO 3166-1 alpha-2 code.](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)
      - `language` string, nullable: [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) code.
      - `phone_number` string, nullable: For New Zealand customers only.
      - `swedish_identity_number` string, nullable: For Swedish customers only. The civic/company number (personnummer, samordningsnummer, or organisationsnummer) of the customer.
      - `danish_identity_number` string, nullable: For Danish customers only. The civic/company number (CPR or CVR) of the customer.
    - `prefilled_bank_account` object: Bank account information used to prefill the payment page so your customer doesn't have to re-type details you already hold about them. It will be stored unvalidated and the customer will be able to review and amend it before completing the form.
      - `account_type` 'savings' | 'checking', nullable: Bank account type for USD-denominated bank accounts. Must not be provided for bank accounts in other currencies. See [local details](https://docs.gocardless.com/docs/api-reference/local-bank-details#united-states) for more information.
    - `links` object
      - `creditor` string: The [creditor](https://docs.gocardless.com/docs/api-reference/creditor) for whom the mandate will be created. The `name` of the creditor will be displayed on the payment page. Required if your account manages multiple creditors.
    - `metadata` RedirectFlowMetadata: Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50 characters and values up to 500 characters. _Note:_ This should not be used for storing PII data.

## Response `201`

Resource created successfully

- RedirectFlowSingleResourceResponse
  - `redirect_flows` RedirectFlow: <p class="deprecated-notice"><strong>Deprecated</strong>: Redirect Flows are legacy APIs and cannot be used by new integrators. The <a href="https://docs.gocardless.com/docs/api-reference/billing-request">Billing Request flow</a> API should be used for your payment flows.</p> Redirect flows enable you to use GoCardless' [hosted payment pages](https://pay-sandbox.gocardless.com/AL000000AKFPFF) to set up mandates with your customers. These pages are fully compliant and have been translated into Danish, Dutch, French, German, Italian, Norwegian, Portuguese, Slovak, Spanish and Swedish. The overall flow is: 1. You [create](https://docs.gocardless.com/docs/api-reference/redirect-flow#create-a-redirect-flow) a redirect flow for your customer, and redirect them to the returned redirect url, e.g. `https://pay.gocardless.com/flow/RE123`. 2. Your customer supplies their name, email, address, and bank account details, and submits the form. This securely stores their details, and redirects them back to your `success_redirect_url` with `redirect_flow_id=RE123` in the querystring. 3. You [complete](https://docs.gocardless.com/docs/api-reference/redirect-flow#complete-a-redirect-flow) the redirect flow, which creates a [customer](https://docs.gocardless.com/docs/api-reference/customer), [customer bank account](https://docs.gocardless.com/docs/api-reference/customer-bank-account), and [mandate](https://docs.gocardless.com/docs/api-reference/mandate), and returns the ID of the mandate. You may wish to create a [subscription](https://docs.gocardless.com/docs/api-reference/subscription) or [payment](https://docs.gocardless.com/docs/api-reference/payment) at this point. Once you have [completed](https://docs.gocardless.com/docs/api-reference/redirect-flow#complete-a-redirect-flow) the redirect flow via the API, you should display a confirmation page to your customer, confirming that their Direct Debit has been set up. You can build your own page, or redirect to the one we provide in the `confirmation_url` attribute of the redirect flow. Redirect flows expire 30 minutes after they are first created. You cannot complete an expired redirect flow. For an integrator this is shorter and they will expire after 10 minutes.
    - `id` string: Unique identifier, beginning with "RE".
    - `description` string, nullable: A description of the item the customer is paying for. This will be shown on the hosted payment pages.
    - `session_token` string: The customer's session ID must be provided when the redirect flow is set up and again when it is completed. This allows integrators to ensure that the user who was originally sent to the GoCardless payment pages is the one who has completed them.
    - `scheme` 'ach' | 'autogiro' | 'bacs' | 'becs' | 'becs_nz' | 'betalingsservice' | 'pad' | 'sepa_core', nullable: The Direct Debit scheme of the mandate. If specified, the payment pages will only allow the set-up of a mandate for the specified scheme. It is recommended that you leave this blank so the most appropriate scheme is picked based on the customer's bank account.
    - `success_redirect_url` string: The URL to redirect to upon successful mandate setup. You must use a URL beginning `https` in the live environment.
    - `confirmation_url` string: The URL of a confirmation page, which you may optionally redirect the customer to rather than use your own page, that confirms in their chosen language that their Direct Debit has been set up successfully. Only returned once the customer has set up their mandate via the payment pages and the redirect flow has been [completed](https://docs.gocardless.com/docs/api-reference/redirect-flow#complete-a-redirect-flow), and only available for 15 minutes from when you complete the redirect flow. The structure of this URL may change at any time, so you should read it directly from the API response.
    - `redirect_url` string: The URL of the hosted payment pages for this redirect flow. This is the URL you should redirect your customer to.
    - `created_at` string, date-time: Fixed [timestamp](https://docs.gocardless.com/docs/api-reference/data-conventions#dates-and-times), recording when this resource was created.
    - `links` RedirectFlowLinks
      - `creditor` string: The [creditor](https://docs.gocardless.com/docs/api-reference/creditor) for whom the mandate will be created. The `name` of the creditor will be displayed on the payment page.
      - `mandate` string: ID of [mandate](https://docs.gocardless.com/docs/api-reference/mandate) created by this redirect flow.<br/>**Note**: this property will not be present until the redirect flow has been successfully completed.
      - `customer` string: ID of [customer](https://docs.gocardless.com/docs/api-reference/customer) created by this redirect flow.<br/>**Note**: this property will not be present until the redirect flow has been successfully completed.
      - `customer_bank_account` string: ID of [customer bank account](https://docs.gocardless.com/docs/api-reference/customer-bank-account) created by this redirect flow.<br/>**Note**: this property will not be present until the redirect flow has been successfully completed.
      - `billing_request` string: ID of [billing request](https://docs.gocardless.com/docs/api-reference/billing-request) that a redirect flow can create.<br />**Note**: The redirect flow will only create a billing request in the event the redirect flow is eligible to send the payer down this new and improved flow
    - `metadata` RedirectFlowMetadata: Key-value store of custom data. Up to 3 keys are permitted, with key names up to 50 characters and values up to 500 characters. _Note:_ This should not be used for storing PII data.
    - `mandate_reference` string: Mandate reference generated by GoCardless or submitted by an integrator.

## Other responses

- `400`: Bad Request
- `401`: Unauthorised
- `404`: Not found
- `422`: Validation Error
- `500`: Internal Error

---

[API](https://skmtc.dev/gocardless/apis/gocardless-api.md) - [All operations](https://skmtc.dev/gocardless/apis/gocardless-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gocardless/apis/gocardless-api/revisions/4dd3dae45364?raw)
