Setting up mandates with Components#
Use the Billing Request component to set up a Direct Debit mandate for Bacs (UK) and Sepa (EUR). Payers fill in the form and authorise the mandate without leaving your page.

1. Before you start#
Complete the general setup: an access token with GoCardless Components enabled, and an endpoint that mints a ui_components session token. Then add and configure the library.
2. Mount the component#
| Property | Description | Required |
|---|---|---|
| schemes | The payment schemes to enable, as an array (e.g. [GcComponents.Scheme.Bacs]); currently only Bacs (Scheme.Bacs) and SEPA (Scheme.SepaCore) are supported | No |
| creditorId | ID of the creditor to create the billing request under | No |
| prefilledCustomer | Prefills the customer/billing details form, see Prefilled customer details | No |
| onReadyToFulfil | Deprecated since 2.35.0: the component now fulfils the billing request itself, so this callback is no longer called. Before 2.35.0, it received the billing request ID once the payer had submitted everything needed to fulfil it (see Fulfilment) | No |
| onError | (error: GoCardlessError) => void — called on error, in addition to the event bus | No |
See the options shared by all Billing Request flows.
The currency selector is available when no scheme is enforced.

3. Testing#
We recommend testing your checkout end to end before going live. Check that you reach the confirmation screen without errors, then confirm the mandate was created in the GoCardless dashboard or through the API.
In sandbox, you can use our test bank details to complete the flow.

4. Fulfilment is automatic from version 2.35.0 onwards#
From version 2.35.0 onwards: fulfilment is automatic, so you don't need a fulfilment endpoint and you can skip this section. onReadyToFulfil is never called, so remove it, along with your fulfilment endpoint, if you still have them.
On a version before 2.35.0: you must fulfil the billing request from your server. Follow the steps below, and plan to upgrade to the latest version so you can remove them.
In versions before 2.35.0, when a payer completes the checkout flow, a callback signals that the billing request is ready to fulfil. You are responsible for calling POST /billing_requests/{billing_request_id}/actions/fulfil from your server at that point. The component waits up to 10 seconds for the billing request to be fulfilled before timing out and cancelling it.
To do this, pass onReadyToFulfil when creating the component. It receives the billing request ID once the payer has submitted everything needed to fulfil it, and is where you call your fulfilment endpoint:
See the API reference for full details.
Example fulfilment endpoint in Ruby: