Prefilling customer details into Billing Request Flow

If you already hold information about your customer (the payer), you can provide this information before sending your customer through a Billing Request Flow. As a result of prefilling customer data, the customer will need to perform fewer steps to complete their payment flow. This leads to a more seamless experience with less friction for the customer and will result in higher conversion.

There are three ways that prefilling can be done.

  1. Create a customer record via the Collect Customer Details endpoint (Note: this endpoint is restricted to GoCardless Pro and GoCardless Enterprise accounts with custom payment pages upgrade).

    • Doing so will mean that the customer won’t have to complete the customer details page in the Billing Request Flow. They will start the journey further along.

  2. Use an existing customer record with the Billing Request API.

    • Again the customer will not have to complete the customer details page. This is possible because the customer’s details are already available.

  3. Provide customer data as values into the Billing Request Flows API.

    • The customer will have their details added to the form fields in the customer details page and simply needs to confirm them. This significantly reduces friction in the flow.

This flowchart explains which of the above methods you would use for various situations:

Billing Request Prefilling workflow choices

This doc explains how to prefill customer details using each of these approaches before sending someone into a Billing Request Flow.

Create a Billing Request

Create a Billing Request for whatever resources you want to create - our example will ask for a payment of £5. Omitting a customer ID means we’ll create a new, blank customer linked against the request.

Use the Create a Billing Request endpoint:

POST /billing_requests { "billing_requests": { "payment_request": { "currency": "GBP", "amount": "500", "description": "Large pot of Marmalade" } } }

You will receive a full Billing Request. This will contain new customer and customer billing details linked against it which are empty.

It will look like this:

{ "billing_requests": { "id": "BRQ123", "status": "pending", "mandate_request": null, "payment_request": { "currency": "GBP", "amount": "500", "description": "Large pot of Marmalade" "scheme": "faster_payments" }, "links": { "customer": "CU00016VR36GVW", "customer_billing_detail": "CBD000010M15PAC" } } }

Create a Billing Request Flow With Prefilled Customer Details

Create a Billing Request Flow to retrieve a link that can be provided to your customer to complete the request. Provide prefilled customer details in this request:

POST /billing_request_flows { "prefilled_customer": { "given_name": "Paddington", "family_name": "Bear", "email": "paddington.bear@acmeplc.com" }, "links": { "billing_request": "BRQ123" } } }

This returns the Billing Request Flow:

{ "billing_request_flows": { "id": "BRF000012CV7SZN9ZJC3S27AAZ1JFWCW", "auto_fulfil": true, "redirect_uri": null, "authorisation_url": "https://pay.gocardless.com/billing/static/flow?id=BRF000012CV7SZN9ZJC3S27AAZ1JFWCW", "lock_customer_details": false, "lock_bank_account": false, "expires_at": "2021-05-14T15:34:44.693Z", "created_at": "2021-05-07T15:34:44.707Z", "links": { "billing_request": "BRQ123" } } }

If the customer visits the authorisation_url, they will begin the checkout flow asking for their customer details, but with given and family name already prefilled:

The customer can amend any of the prefilled information and complete those fields that haven’t been prefilled.

Final note

It’s worth noting that this same functionality means customers who leave the flow and come back later will resume from where they left off.

Need help?