GoCardless Hosted Pages#
This is the fastest way to start collecting payments. Redirect your customers to a GoCardless-hosted page to complete mandate setup and payment authorisation. Once done, they're redirected back to your site.
Supports: All payment types (one-off, recurring, instalments, Pay By Bank, Instant + DD, Commercial VRP)
Best for#
- Quick implementation with minimal development
- Teams without front-end development resources
- Prototyping and early releases
- A proven, scalable, compliant payment journey
What you get out of the box#
- Mobile-responsive design
- Multi-language support
- Scheme-appropriate authorisation flows per country
- Regulatory compliance handled
- Optimised conversion flow
You can set your company name and logo. For more control over the look and feel, consider the Drop-in Flow or Custom Payment Pages approach.
How it works#
- Create a Billing Request via the API, specifying the payment type
- Create a Billing Request Flow; this generates a hosted URL
- Redirect your customer to the URL
- Customer completes authorisation on the GoCardless-hosted page
- Customer is redirected back to your redirect_uri
- Listen for webhooks to confirm the outcome
Step-by-step guide#
Create a billing request#
The Billing Request defines what you're collecting. The payload differs by payment type:
curl -X POST https://api.gocardless.com/billing_requests \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"billing_requests": {
"mandate_request": {
"scheme": "bacs"
}
}
}'<?php
require 'vendor/autoload.php';
$client = new \GoCardlessPro\Client([
'access_token' => getenv('GC_ACCESS_TOKEN'),
'environment' => \GoCardlessPro\Environment::SANDBOX
]);
$response = $client->billingRequests()->create([
'params' => [
'mandate_request' => [
'scheme' => 'bacs',
],
],
]);import os
import gocardless_pro
client = gocardless_pro.Client(
access_token=os.environ['GC_ACCESS_TOKEN'],
environment='sandbox'
)
response = client.billing_requests.create(
params={
'mandate_request': {
'scheme': 'bacs',
}
}
)require 'gocardless_pro'
client = GoCardlessPro::Client.new(
access_token: ENV['GC_ACCESS_TOKEN'],
environment: :sandbox
)
response = client.billing_requests.create(
params: {
mandate_request: {
scheme: 'bacs'
}
}
)import com.gocardless.GoCardlessClient;
GoCardlessClient client = GoCardlessClient
.newBuilder(System.getenv("GC_ACCESS_TOKEN"))
.withEnvironment(GoCardlessClient.Environment.SANDBOX)
.build();
BillingRequestCreateResponse response = client.billingRequests()
.create()
.withMandateRequestScheme("bacs")
.execute();const gocardless = require("gocardless-nodejs");
const constants = require("gocardless-nodejs/constants");
const client = gocardless(process.env.GC_ACCESS_TOKEN, constants.Environments.Sandbox);
const response = await client.billingRequests.create({
mandate_request: {
scheme: "bacs",
},
});using GoCardless;
var client = GoCardlessClient.Create(
Environment.GetEnvironmentVariable("GC_ACCESS_TOKEN"),
GoCardlessClient.Environment.SANDBOX
);
var response = await client.BillingRequests.CreateAsync(
new BillingRequestCreateRequest
{
MandateRequest = new BillingRequestCreateRequest.BillingRequestMandateRequest
{
Scheme = "bacs"
}
}
);package main
import (
"context"
"fmt"
"os"
gocardless "github.com/gocardless/gocardless-pro-go/v6"
)
func main() {
opts := gocardless.WithEndpoint(gocardless.SandboxEndpoint)
client, err := gocardless.New(os.Getenv("GC_ACCESS_TOKEN"), opts)
if err != nil {
panic(err)
}
params := gocardless.BillingRequestCreateParams{
MandateRequest: &gocardless.BillingRequestCreateParamsMandateRequest{
Scheme: "bacs",
},
}
result, err := client.BillingRequests.Create(context.TODO(), params)
if err != nil {
panic(err)
}
fmt.Println(result)
}Response:
{
"billing_requests": {
"id": "BRQ0000301",
"status": "pending",
"mandate_request": {
"scheme": "bacs",
"currency": "GBP"
},
"actions": [
{
"type": "collect_customer_details",
"required": true,
"completed": false
},
{
"type": "collect_bank_account",
"required": true,
"completed": false
},
{
"type": "confirm_payer_details",
"required": true,
"completed": false
}
]
}
}curl -X POST https://api.gocardless.com/billing_requests \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"billing_requests": {
"payment_request": {
"description": "Order #9012",
"amount": 12000, "currency": "GBP", "scheme": "faster_payments"
}
}
}'<?php
require 'vendor/autoload.php';
$client = new \GoCardlessPro\Client([
'access_token' => getenv('GC_ACCESS_TOKEN'),
'environment' => \GoCardlessPro\Environment::SANDBOX
]);
$response = $client->billingRequests()->create([
'params' => [
'payment_request' => [
'description' => 'Order #9012',
'amount' => 12000,
'currency' => 'GBP',
'scheme' => 'faster_payments',
],
],
]);import os
import gocardless_pro
client = gocardless_pro.Client(
access_token=os.environ['GC_ACCESS_TOKEN'],
environment='sandbox'
)
response = client.billing_requests.create(
params={
'payment_request': {
'description': 'Order #9012',
'amount': 12000,
'currency': 'GBP',
'scheme': 'faster_payments',
}
}
)
require 'gocardless_pro'
client = GoCardlessPro::Client.new(
access_token: ENV['GC_ACCESS_TOKEN'],
environment: :sandbox
)
response = client.billing_requests.create(
params: {
payment_request: {
description: 'Order #9012',
amount: 12000,
currency: 'GBP',
scheme: 'faster_payments'
}
}
)import com.gocardless.GoCardlessClient;
GoCardlessClient client = GoCardlessClient
.newBuilder(System.getenv("GC_ACCESS_TOKEN"))
.withEnvironment(GoCardlessClient.Environment.SANDBOX)
.build();
BillingRequestCreateResponse response = client.billingRequests()
.create()
.withPaymentRequestDescription("Order #9012")
.withPaymentRequestAmount(12000)
.withPaymentRequestCurrency("GBP")
.withPaymentRequestScheme("faster_payments")
.execute();const gocardless = require("gocardless-nodejs");
const constants = require("gocardless-nodejs/constants");
const client = gocardless(process.env.GC_ACCESS_TOKEN, constants.Environments.Sandbox);
const response = await client.billingRequests.create({
payment_request: {
description: "Order #9012",
amount: 12000,
currency: "GBP",
scheme: "faster_payments",
},
});using GoCardless;
var client = GoCardlessClient.Create(
Environment.GetEnvironmentVariable("GC_ACCESS_TOKEN"),
GoCardlessClient.Environment.SANDBOX
);
var response = await client.BillingRequests.CreateAsync(
new BillingRequestCreateRequest
{
PaymentRequest = new BillingRequestCreateRequest.BillingRequestPaymentRequest
{
Description = "Order #9012",
Amount = 12000,
Currency = "GBP",
Scheme = "faster_payments"
}
}
);package main
import (
"context"
"fmt"
"os"
gocardless "github.com/gocardless/gocardless-pro-go/v6"
)
func main() {
opts := gocardless.WithEndpoint(gocardless.SandboxEndpoint)
client, err := gocardless.New(os.Getenv("GC_ACCESS_TOKEN"), opts)
if err != nil {
panic(err)
}
params := gocardless.BillingRequestCreateParams{
PaymentRequest: &gocardless.BillingRequestCreateParamsPaymentRequest{
Description: "Order #9012",
Amount: 12000,
Currency: "GBP",
Scheme: "faster_payments",
},
}
result, err := client.BillingRequests.Create(context.TODO(), params)
if err != nil {
panic(err)
}
fmt.Println(result)
}Response:
{
"billing_requests": {
"id": "BRQ0000302",
"status": "pending",
"payment_request": {
"amount": 12000,
"currency": "GBP",
"scheme": "faster_payments"
},
"actions": [
{
"type": "collect_customer_details",
"required": true,
"completed": false
},
{
"type": "select_institution",
"required": true,
"completed": false
},
{
"type": "bank_authorisation",
"required": true,
"completed": false
}
]
}
}curl -X POST https://api.gocardless.com/billing_requests \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"billing_requests": {
"payment_request": {
"description": "First payment",
"amount": 5000, "currency": "GBP", "scheme": "faster_payments"
},
"mandate_request": { "scheme": "bacs" }
}
}'<?php
require 'vendor/autoload.php';
$client = new \GoCardlessPro\Client([
'access_token' => getenv('GC_ACCESS_TOKEN'),
'environment' => \GoCardlessPro\Environment::SANDBOX
]);
$response = $client->billingRequests()->create([
'params' => [
'payment_request' => [
'description' => 'First payment',
'amount' => 5000,
'currency' => 'GBP',
'scheme' => 'faster_payments',
],
'mandate_request' => [
'scheme' => 'bacs',
],
],
]);import os
import gocardless_pro
client = gocardless_pro.Client(
access_token=os.environ['GC_ACCESS_TOKEN'],
environment='sandbox'
)
response = client.billing_requests.create(
params={
'payment_request': {
'description': 'First payment',
'amount': 5000,
'currency': 'GBP',
'scheme': 'faster_payments',
},
'mandate_request': {
'scheme': 'bacs',
},
}
) require 'gocardless_pro'
client = GoCardlessPro::Client.new(
access_token: ENV['GC_ACCESS_TOKEN'],
environment: :sandbox
)
response = client.billing_requests.create(
params: {
payment_request: {
description: 'First payment',
amount: 5000,
currency: 'GBP',
scheme: 'faster_payments'
},
mandate_request: {
scheme: 'bacs'
}
}
)import com.gocardless.GoCardlessClient;
GoCardlessClient client = GoCardlessClient
.newBuilder(System.getenv("GC_ACCESS_TOKEN"))
.withEnvironment(GoCardlessClient.Environment.SANDBOX)
.build();
BillingRequestCreateResponse response = client.billingRequests()
.create()
.withPaymentRequestDescription("First payment")
.withPaymentRequestAmount(5000)
.withPaymentRequestCurrency("GBP")
.withPaymentRequestScheme("faster_payments")
.withMandateRequestScheme("bacs")
.execute();const gocardless = require("gocardless-nodejs");
const constants = require("gocardless-nodejs/constants");
const client = gocardless(process.env.GC_ACCESS_TOKEN, constants.Environments.Sandbox);
const response = await client.billingRequests.create({
payment_request: {
description: "First payment",
amount: 5000,
currency: "GBP",
scheme: "faster_payments",
},
mandate_request: {
scheme: "bacs",
},
});using GoCardless;
var client = GoCardlessClient.Create(
Environment.GetEnvironmentVariable("GC_ACCESS_TOKEN"),
GoCardlessClient.Environment.SANDBOX
);
var response = await client.BillingRequests.CreateAsync(
new BillingRequestCreateRequest
{
PaymentRequest = new BillingRequestCreateRequest.BillingRequestPaymentRequest
{
Description = "First payment",
Amount = 5000,
Currency = "GBP",
Scheme = "faster_payments"
},
MandateRequest = new BillingRequestCreateRequest.BillingRequestMandateRequest
{
Scheme = "bacs"
}
}
);package main
import (
"context"
"fmt"
"os"
gocardless "github.com/gocardless/gocardless-pro-go/v6"
)
func main() {
opts := gocardless.WithEndpoint(gocardless.SandboxEndpoint)
client, err := gocardless.New(os.Getenv("GC_ACCESS_TOKEN"), opts)
if err != nil {
panic(err)
}
params := gocardless.BillingRequestCreateParams{
PaymentRequest: &gocardless.BillingRequestCreateParamsPaymentRequest{
Description: "First payment",
Amount: 5000,
Currency: "GBP",
Scheme: "faster_payments",
},
MandateRequest: &gocardless.BillingRequestCreateParamsMandateRequest{
Scheme: "bacs",
},
}
result, err := client.BillingRequests.Create(context.TODO(), params)
if err != nil {
panic(err)
}
fmt.Println(result)
}Response:
{
"billing_requests": {
"id": "BRQ0000303",
"status": "pending",
"payment_request": {
"amount": 5000,
"currency": "GBP",
"scheme": "faster_payments"
},
"mandate_request": {
"scheme": "bacs",
"currency": "GBP"
},
"actions": [
{
"type": "collect_customer_details",
"required": true,
"completed": false
},
{
"type": "collect_bank_account",
"required": true,
"completed": false
},
{
"type": "confirm_payer_details",
"required": true,
"completed": false
},
{
"type": "select_institution",
"required": true,
"completed": false
},
{
"type": "bank_authorisation",
"required": true,
"completed": false
}
]
}
}curl -X POST https://api.gocardless.com/billing_requests \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"billing_requests": {
"fallback_enabled": true,
"purpose_code": "loan",
"payment_context_code": "billing_goods_and_services_in_arrears",
"payment_purpose_code": "bank_loan_delayed_draw_funding",
"mandate_request": {
"scheme": "faster_payments",
"constraints": {
"start_date": "2024-11-01",
"max_amount_per_payment": 50000,
"periodic_limits": [{
"period": "month",
"max_total_amount": 100000,
"alignment": "creation_date"
}]
}
}
}
}'<?php
require 'vendor/autoload.php';
$client = new \GoCardlessPro\Client([
'access_token' => getenv('GC_ACCESS_TOKEN'),
'environment' => \GoCardlessPro\Environment::SANDBOX
]);
$response = $client->billingRequests()->create([
'params' => [
'fallback_enabled' => true,
'purpose_code' => 'loan',
'payment_context_code' => 'billing_goods_and_services_in_arrears',
'payment_purpose_code' => 'bank_loan_delayed_draw_funding',
'mandate_request' => [
'scheme' => 'faster_payments',
'constraints' => [
'start_date' => '2024-11-01',
'max_amount_per_payment' => 50000,
'periodic_limits' => [
[
'period' => 'month',
'max_total_amount' => 100000,
'alignment' => 'creation_date',
],
],
],
],
],
]);import os
import gocardless_pro
client = gocardless_pro.Client(
access_token=os.environ['GC_ACCESS_TOKEN'],
environment='sandbox'
)
response = client.billing_requests.create(
params={
'fallback_enabled': True,
'purpose_code': 'loan',
'payment_context_code': 'billing_goods_and_services_in_arrears',
'payment_purpose_code': 'bank_loan_delayed_draw_funding',
'mandate_request': {
'scheme': 'faster_payments',
'constraints': {
'start_date': '2024-11-01',
'max_amount_per_payment': 50000,
'periodic_limits': [
{
'period': 'month',
'max_total_amount': 100000,
'alignment': 'creation_date',
},
],
},
},
}
)require 'gocardless_pro'
client = GoCardlessPro::Client.new(
access_token: ENV['GC_ACCESS_TOKEN'],
environment: :sandbox
)
response = client.billing_requests.create(
params: {
fallback_enabled: true,
purpose_code: 'loan',
payment_context_code: 'billing_goods_and_services_in_arrears',
payment_purpose_code: 'bank_loan_delayed_draw_funding',
mandate_request: {
scheme: 'faster_payments',
constraints: {
start_date: '2024-11-01',
max_amount_per_payment: 50000,
periodic_limits: [
{
period: 'month',
max_total_amount: 100000,
alignment: 'creation_date'
}
]
}
}
}
)import com.gocardless.GoCardlessClient;
GoCardlessClient client = GoCardlessClient
.newBuilder(System.getenv("GC_ACCESS_TOKEN"))
.withEnvironment(GoCardlessClient.Environment.SANDBOX)
.build();
BillingRequestCreateResponse response = client.billingRequests()
.create()
.withFallbackEnabled(true)
.withPurposeCode("loan")
.withPaymentContextCode("billing_goods_and_services_in_arrears")
.withPaymentPurposeCode("bank_loan_delayed_draw_funding")
.withMandateRequestScheme("faster_payments")
.withMandateRequestConstraintsStartDate("2024-11-01")
.withMandateRequestConstraintsMaxAmountPerPayment(50000)
.withMandateRequestConstraintsPeriodicLimitsBuilder()
.withPeriod("month")
.withMaxTotalAmount(100000)
.withAlignment("creation_date")
.done()
.execute();const gocardless = require("gocardless-nodejs");
const constants = require("gocardless-nodejs/constants");
const client = gocardless(process.env.GC_ACCESS_TOKEN, constants.Environments.Sandbox);
const response = await client.billingRequests.create({
fallback_enabled: true,
purpose_code: "loan",
payment_context_code: "billing_goods_and_services_in_arrears",
payment_purpose_code: "bank_loan_delayed_draw_funding",
mandate_request: {
scheme: "faster_payments",
constraints: {
start_date: "2024-11-01",
max_amount_per_payment: 50000,
periodic_limits: [
{
period: "month",
max_total_amount: 100000,
alignment: "creation_date",
},
],
},
},
});using GoCardless;
var client = GoCardlessClient.Create(
Environment.GetEnvironmentVariable("GC_ACCESS_TOKEN"),
GoCardlessClient.Environment.SANDBOX
);
var response = await client.BillingRequests.CreateAsync(
new BillingRequestCreateRequest
{
FallbackEnabled = true,
PurposeCode = "loan",
PaymentContextCode = "billing_goods_and_services_in_arrears",
PaymentPurposeCode = "bank_loan_delayed_draw_funding",
MandateRequest = new BillingRequestCreateRequest.BillingRequestMandateRequest
{
Scheme = "faster_payments",
Constraints = new BillingRequestCreateRequest.BillingRequestMandateRequestConstraints
{
StartDate = "2024-11-01",
MaxAmountPerPayment = 50000,
PeriodicLimits = new List<BillingRequestCreateRequest.BillingRequestMandateRequestConstraintsPeriodicLimit>
{
new BillingRequestCreateRequest.BillingRequestMandateRequestConstraintsPeriodicLimit
{
Period = "month",
MaxTotalAmount = 100000,
Alignment = "creation_date"
}
}
}
}
}
);package main
import (
"context"
"fmt"
"os"
gocardless "github.com/gocardless/gocardless-pro-go/v6"
)
func main() {
opts := gocardless.WithEndpoint(gocardless.SandboxEndpoint)
client, err := gocardless.New(os.Getenv("GC_ACCESS_TOKEN"), opts)
if err != nil {
panic(err)
}
fallbackEnabled := true
params := gocardless.BillingRequestCreateParams{
FallbackEnabled: &fallbackEnabled,
PurposeCode: "loan",
PaymentContextCode: "billing_goods_and_services_in_arrears",
PaymentPurposeCode: "bank_loan_delayed_draw_funding",
MandateRequest: &gocardless.BillingRequestCreateParamsMandateRequest{
Scheme: "faster_payments",
Constraints: &gocardless.BillingRequestCreateParamsMandateRequestConstraints{
StartDate: "2024-11-01",
MaxAmountPerPayment: 50000,
PeriodicLimits: []gocardless.BillingRequestCreateParamsMandateRequestConstraintsPeriodicLimit{
{
Period: "month",
MaxTotalAmount: 100000,
Alignment: "creation_date",
},
},
},
},
}
result, err := client.BillingRequests.Create(context.TODO(), params)
if err != nil {
panic(err)
}
fmt.Println(result)
}Response:
{
"billing_requests": {
"id": "BRQ0000301",
"created_at": "2024-11-01T00:00:00.000Z",
"status": "pending",
"mandate_request": {
"scheme": "faster_payments",
"currency": "GBP",
"verify": "recommended",
"consent_type": "recurring",
"description": null,
"sweeping": false,
"payer_requested_dual_signature": false,
"metadata": {},
"links": {},
"constraints": {
"start_date": "2024-11-01",
"end_date": null,
"max_amount_per_payment": 50000,
"periodic_limits": [
{
"period": "month",
"max_total_amount": 100000,
"alignment": "creation_date",
"max_amount_per_period": null,
"max_payments": null
}
]
}
},
"payment_request": null,
"subscription_request": null,
"instalment_schedule_request": null,
"metadata": {},
"fallback_enabled": true,
"fallback_occurred": false,
"purpose_code": "loan",
"payment_purpose_code": "bank_loan_delayed_draw_funding",
"sign_flow_url": null,
"auto_fulfil": false,
"actions": [
{
"type": "collect_customer_details",
"required": true,
"completes_actions": [],
"requires_actions": [],
"status": "pending",
"collect_customer_details": {
"default_country_code": "GB",
"incomplete_fields": {
"customer": ["given_name", "family_name", "email"],
"customer_billing_detail": ["address_line1", "city", "postal_code", "country_code"]
}
}
},
{
"type": "select_institution",
"required": true,
"completes_actions": [],
"requires_actions": [],
"status": "pending",
"institution_guess_status": "pending"
},
{
"type": "collect_bank_account",
"required": true,
"completes_actions": [],
"requires_actions": [],
"status": "pending",
"available_country_codes": ["GB"]
},
{
"type": "bank_authorisation",
"required": true,
"completes_actions": [],
"requires_actions": ["select_institution", "collect_customer_details"],
"status": "pending",
"bank_authorisation": {
"authorisation_type": "mandate"
}
},
{
"type": "confirm_payer_details",
"required": true,
"completes_actions": [],
"requires_actions": ["collect_customer_details", "collect_bank_account"],
"status": "pending"
}
],
"links": {
"mandate_request": "MRQ0000301"
}
}
}Create a billing request flow#
This generates the hosted URL where the customer completes authorisation.
POST https://api.gocardless.com/billing_request_flows HTTP/1.1
{
"billing_request_flows": {
"redirect_uri": "https://my-company.com/landing",
"exit_uri": "https://my-company.com/exit",
"links": {
"billing_request": "BRQ000010NMDMH2"
}
}
}$client = new \GoCardlessPro\Client(array(
'access_token' => 'your_access_token_here',
'environment' => \GoCardlessPro\Environment::SANDBOX
));
$client->billingRequestFlows()->create([
"params" => [
"redirect_uri" => "https://my-company.com/landing",
"exit_uri" => "https://my-company.com/exit",
"links" => [
"billing_request" => "BRQ000010NMDMH2"
]
]
]);
import gocardless_pro
client = gocardless_pro.Client(access_token="your_access_token_here", environment='sandbox')
client.billing_request_flows.create(params={
"redirect_uri": "https://my-company.com/landing",
"exit_uri": "https://my-company.com/exit",
"links": {
"billing_request": "BRQ000010NMDMH2"
}
})@client = GoCardlessPro::Client.new(
access_token: "your_access_token",
environment: :sandbox
)
@client.billing_request_flows.create(
params: {
redirect_uri: "https://my-company.com/landing",
exit_uri: "https://my-company.com/exit",
links: {
billing_request: "BRQ000010NMDMH2",
}
}
)import static com.gocardless.GoCardlessClient.Environment.SANDBOX;
String accessToken = "your_access_token_here";
GoCardlessClient client = GoCardlessClient
.newBuilder(accessToken)
.withEnvironment(SANDBOX)
.build();
BillingRequestFlow billingRequestFlow = client.billingRequestFlows().create()
.withRedirectUri("https://my-company.com/landing")
.withExitUri("https://my-company.com/exit")
.withLinksBillingRequest("BRQ000010NMDMH2")
.execute();const constants = require("gocardless-nodejs/constants");
const gocardless = require("gocardless-nodejs");
const client = gocardless("your_access_token_here", constants.Environments.Sandbox);
const billingRequestFlow = await client.billingRequestFlows.create({
redirect_uri: "https://my-company.com/landing",
exit_uri: "https://my-company.com/exit",
links: {
billing_request: "BRQ000010NMDMH2",
},
});String accessToken = "your_access_token";
GoCardlessClient gocardless = GoCardlessClient.Create(accessToken, Environment.SANDBOX);
var resp = await gocardless.BillingRequestFlows.CreateAsync(
new GoCardless.Services.BillingRequestFlowCreateRequest()
{
RedirectUri = "https://my-company.com/landing",
ExitUri = "https://my-company.com/exit",
Links = new GoCardless.Services.BillingRequestFlowCreateRequest.BillingRequestFlowLinks {
BillingRequest = "BRQ000010NMDMH2",
},
}
);
GoCardless.Resources.BillingRequestFlow billingRequestFlow = resp.BillingRequestFlow;package main
import (
gocardless "github.com/gocardless/gocardless-pro-go/v6"
)
accessToken := "your_access_token_here";
opts := gocardless.WithEndpoint(gocardless.SandboxEndpoint)
client, err := gocardless.New(accessToken, opts)
billingRequestFlowCreateParams := gocardless.BillingRequestFlowCreateParams{}
billingRequestFlowCreateParams.RedirectUri = "https://my-company.com/landing"
billingRequestFlowCreateParams.ExitUri = "https://my-company.com/exit"
billingRequestFlowCreateParams.Links.BillingRequest = "BRQ000010NMDMH2"
billingRequestFlow, err := client.BillingRequestFlows.Create(context, billingRequestFlowCreateParams)gc create billing_request_flow \
-d "links[billing_request]= BRQ000010NMDMH2" \
-d 'redirect_uri=https://my-company.com/landing' \
-d 'exit_uri=https://my-company.com/exit'Response:
{
"billing_request_flows": {
"authorisation_url": "https://pay.gocardless.com/billing/static/flow?id=<brf_id>",
"lock_customer_details": false,
"lock_bank_account": false,
"auto_fulfil": true,
"created_at": "2021-03-30T16:23:10.679Z",
"expires_at": "2021-04-06T16:23:10.679Z",
"redirect_uri": "https://my-company.com/completed",
"links": {
"billing_request": "BRQ123"
}
}
}The response includes an authorisation_url; redirect your customer there.
Handle the redirect#
Send your customer to the authorisation_url. GoCardless collects any required details: name, email, bank account and handles the scheme-appropriate authorisation flow.
When the customer completes or exits, they are redirected to your redirect_uri or exit_uri with query parameters:
| Parameter | Example value |
|---|---|
| billing_request_id | BRQ0000101 |
| billing_request_flow_id | BRF0000101 |
Don't use the redirect to confirm the outcome. Always use webhooks.
Listen for webhooks#
| Event | Meaning |
|---|---|
| billing_request_fulfilled | Customer completed the flow |
| mandate_created | Mandate is active (for DD payment types) |
| payment_confirmed | Payment confirmed (for Pay By Bank) |
| billing_request_flow_expired | The customer didn't complete on time |
Pre-collecting customer details#
If you already have the customer's name, email, and address, submit them before creating the flow. The hosted page skips those fields or locks them if you prefer.
Collect customer details (optional)#
POST /billing_requests/BRQ000010NMDMH2/actions/collect_customer_details HTTP/1.1
{
"data": {
"customer": {
"email": "paddington@bearthings.com",
"given_name": "Paddington",
"family_name": "Bear"
},
"customer_billing_detail": {
"address_line1": "32 Windsor Gardens",
"city": "London",
"postal_code": "W9 3RG",
"country_code": "GB"
}
}
}$client = new \GoCardlessPro\Client(array(
'access_token' => 'your_access_token_here',
'environment' => \GoCardlessPro\Environment::SANDBOX
));
$client->billingRequests()->collectCustomerDetails("BR123", [
"params" => [
"customer" => [
"email" => "paddington@bearthings.com"
"given_name" => "Paddington",
"family_name" => "Bear"
],
"customer_billing_detail" => [
"address_line1" => "32 Windsor Gardens",
"city" => "London",
"postal_code" => "W9 3RG",
"country_code" => "GB"
]
]
]);
import gocardless_pro
client = gocardless_pro.Client(access_token="your_access_token_here", environment='sandbox')
client.billing_requests.collect_customer_details("BR123", params={
customer: {
email: "paddington@bearthings.com"
given_name: "Paddington",
family_name: "Bear",
},
customer_billing_detail: {
address_line1: "32 Windsor Gardens",
city: "London",
postal_code: "W9 3RG",
country_code: "GB",
}
})@client = GoCardlessPro::Client.new(
access_token: "your_access_token",
environment: :sandbox
)
@client.billing_requests.collect_customer_details("BR123", {
params: {
customer: {
email: "paddington@bearthings.com"
given_name: "Paddington",
family_name: "Bear",
},
customer_billing_detail: {
address_line1: "32 Windsor Gardens",
city: "London",
postal_code: "W9 3RG",
country_code: "GB".
}
}
})@client = GoCardlessPro::Client.new(
access_token: "your_access_token",
environment: :sandbox
)
@client.billing_requests.collect_customer_details("BR123", {
params: {
customer: {
email: "paddington@bearthings.com"
given_name: "Paddington",
family_name: "Bear",
},
customer_billing_detail: {
address_line1: "32 Windsor Gardens",
city: "London",
postal_code: "W9 3RG",
country_code: "GB"
}
}
})const constants = require('gocardless-nodejs/constants');
const gocardless = require('gocardless-nodejs');
const client = gocardless('your_access_token_here', constants.Environments.Sandbox);
const resp = await client.billingRequests.collectCustomerDetails("BR123", {
customer: {
email: "paddington@bearthings.com"
given_name: "Paddington",
family_name: "Bear",
},
customer_billing_detail: {
address_line1: "32 Windsor Gardens",
city: "London",
postal_code: "W9 3RG",
country_code: "GB"
}
});String accessToken = "your_access_token";
GoCardlessClient gocardless = GoCardlessClient.Create(accessToken, Environment.SANDBOX);
var customer = new GoCardless.Services.BillingRequestCollectCustomerDetailsRequest.BillingRequestCustomer
{
Email = "paddington@bearthings.com",
GivenName = "Paddington",
FamilyName = "Bear",
};
var customerBillingDetail =new GoCardless.Services.BillingRequestCollectCustomerDetailsRequest.BillingRequestCustomerBillingDetail
{
AddressLine1 = "32 Windsor Gardens",
City = "London",
PostalCode = "W9 3RG",
CountryCode = "GB",
};
var resp = await gocardless.BillingRequests.CollectCustomerDetails("BR123",
new GoCardless.Services.BillingRequestCollectCustomerDetailsRequest
{
Customer = customer,
CustomerBillingDetail = customerBillingDetail,
});package main
import (
gocardless "github.com/gocardless/gocardless-pro-go/v6"
)
accessToken := "your_access_token_here"
config, err := gocardless.NewConfig(accessToken, gocardless.WithEndpoint(gocardless.SandboxEndpoint))
if err != nil {
fmt.Printf("got err in initialising config: %s", err.Error())
return
}
client, err := gocardless.New(config)
if err != nil {
fmt.Println("error in initialisating client: %s", err.Error())
return
}
billingRequestCollectCustomerDetailsParams := gocardless.BillingRequestCollectCustomerDetailsParams{
Customer: &gocardless.BillingRequestCollectCustomerDetailsParamsCustomer{
GivenName: "Paddington",
FamilyName: "Bear",
Email: "paddington@bearthings.com",
},
CustomerBillingDetail: &gocardless.BillingRequestCollectCustomerDetailsParamsCustomerBillingDetail{
AddressLine1: "32 Windsor Gardens",
City: "London",
PostalCode: "W9 3RG",
CountryCode: "GB",
},
}
billingRequest, err := client.BillingRequests.CollectCustomerDetails(context, "BR123", billingRequestCollectCustomerDetailsParams)Response: Updated Billing Request with collect_customer_details marked completed.
Collect bank account (optional)#
POST /billing_requests/BRQ000010NMDMH2/actions/collect_bank_account HTTP/1.1
{
"data": {
"account_number": "11223344",
"branch_code": "040004",
"account_holder_name": "Paddington Bear",
"country_code": "GB"
}
}$client = new \GoCardlessPro\Client(array(
'access_token' => 'your_access_token_here',
'environment' => \GoCardlessPro\Environment::SANDBOX
));
$client->billingRequests()->collectBankAccount("BRQ000010NMDMH2", [
"params" => [
"account_number" => "55779911",
"branch_code" => "200000",
"account_holder_name" => "Frank Osborne",
"country_code" => "GB"
]
]);
import gocardless_pro
client = gocardless_pro.Client(access_token="your_access_token_here", environment='sandbox')
client.billing_requests.collect_bank_account("BRQ000010NMDMH2", params={
account_number: "55779911",
branch_code: "200000",
account_holder_name: "Frank Osborne",
country_code: "GB",
})@client = GoCardlessPro::Client.new(
access_token: "your_access_token",
environment: :sandbox
)
@client.billing_requests.collect_bank_account("BRQ000010NMDMH2", {
params: {
account_number: "55779911",
branch_code: "200000",
account_holder_name: "Frank Osborne",
country_code: "GB",
}
})import static com.gocardless.GoCardlessClient.Environment.SANDBOX;
String accessToken = "your_access_token_here";
GoCardlessClient client = GoCardlessClient
.newBuilder(accessToken)
.withEnvironment(SANDBOX)
.build();
client.billingRequests().collectBankAccount("BRQ000010NMDMH2")
.withAccountNumber("55779911")
.withBranchCode("200000")
.withAccountHolderName("Frank Osborne")
.withCountryCode("GB")
.execute();const constants = require("gocardless-nodejs/constants");
const gocardless = require("gocardless-nodejs");
const client = gocardless("your_access_token_here", constants.Environments.Sandbox);
const resp = await client.billingRequests.collectBankAccount("BRQ000010NMDMH2", {
account_number: "55779911",
branch_code: "200000",
account_holder_name: "Frank Osborne",
country_code: "GB",
});String accessToken = "your_access_token";
GoCardlessClient gocardless = GoCardlessClient.Create(accessToken, Environment.SANDBOX);
var resp = await gocardless.BillingRequests.CollectBankAccountAsync("BRQ000010NMDMH2",
new BillingRequestCollectBankAccountRequest
{
AccountNumber = "55779911",
BranchCode = "200000",
AccountHolderName = "Frank Osborne",
CountryCode = "GB",
});package main
import (
gocardless "github.com/gocardless/gocardless-pro-go/v6"
)
accessToken := "your_access_token_here"
config, err := gocardless.NewConfig(accessToken, gocardless.WithEndpoint(gocardless.SandboxEndpoint))
if err != nil {
fmt.Printf("got err in initialising config: %s", err.Error())
return
}
client, err := gocardless.New(config)
if err != nil {
fmt.Println("error in initialisating client: %s", err.Error())
return
}
billingRequestCollectBankAccountParams := gocardless.BillingRequestCollectBankAccountParams{
BranchCode: "200000",
CountryCode: "GB",
AccountNumber: "55779911",
AccountHolderName: "Frank Osborne",
}
billingRequest, err := client.BillingRequests.CollectBankAccount(context, "BRQ000010NMDMH2", billingRequestCollectBankAccountParams)Response: Updated Billing Request with collect_bank_account marked completed.
When creating the Billing Request Flow, pass lock_customer_details: true and/or
lock_bank_account: true to prevent customers editing pre-filled values.
What's next?#
Create mandates and collect bank account details via the API.
Skip form steps by supplying customer details before the hosted flow.
Embed the payment flow directly on your site without redirecting customers.
Full API control for teams that need complete UX ownership.