GoCardlessDeveloper Docs
Create a sandbox account

Collecting a Direct Debit payment#

View as Markdown

After calling the Billing Request with Actions we will now use the mandate ID (MD123) from the API response in order to create a Direct Debit payment.

For this reason we'll now call the Payments API.

POST https://api.gocardless.com/payments HTTP/1.1
Content-Type: application/json
{
"payments": {
  "amount": 123,
  "currency": "GBP",
  "reference": "Wine Box",
  "charge_date": "2026-12-31",
  "links": {
    "mandate": "MD123"
  },
  "metadata": {
    "internal_order_number": "ID123"
  },
}
}

HTTP/1.1 201 Created
Location: /payments/PM123
Content-Type: application/json
{
"payments": {
"id": "PM123",
"scheme": "bacs"
...
"charge_date": "2026-12-31",
"amount": 123,
...
"status": "pending_submission",
...
"links": {
"mandate": "MD123",
"creditor": "CR123"
},
...
}
}
$client->payments()->create([
"params" => [
"amount" => 123,
"currency" => "GBP",
"reference" => "Wine Box",
"charge_date" => "2026-12-31",
"metadata" => [
"internal_order_number" => "ID123"
],
"links" => [
"mandate" => "MD123"
]
]
]);
client.payments.create(params={
"amount": 123,
"currency": "GBP",
"reference": "Wine Box",
"charge_date": "2026-12-31",
"metadata": {
"internal_order_number": "ID123"
},
"links": {
"mandate": "MD123"
}
})
@client.payments.create(
params: {
amount: 123,
currency: "GBP",
reference: "Wine Box",
charge_date: "2026-12-31",
metadata: {
internal_order_number: "ID123"
},
links: {
mandate: "MD123"
}
}
)
import com.gocardless.services.PaymentService.PaymentCreateRequest.Currency;

Payment payment = client.payments().create()
.withAmount(123)
.withCurrency(Currency.GBP)
.withReference("Wine Box")
.withChargeDate("2026-12-31")
.withMetadata("internal_order_number", "ID123")
.withLinksMandate("MD123")
.execute();
const payment = await client.payments.create({
amount: 123,
currency: "GBP",
reference: "Wine Box",
charge_date: "2026-12-31",
metadata: {
internal_order_number: "ID123",
},
links: {
mandate: "MD123",
},
});
var paymentRequest = new GoCardless.Services.PaymentCreateRequest()
{
Amount = 123,
Currency = GoCardless.Services.PaymentCreateRequest.PaymentCurrency.GBP,
Reference = "Wine Box",
ChargeDate = "2026-12-31",
Metadata = new Dictionary<string, string>()
{
{"internal_order_number", "ID123"}
},
Links = new GoCardless.Services.PaymentCreateRequest.PaymentLinks()
{
Mandate = "MD123"
}
};

var paymentResponse = await gocardless.Payments.CreateAsync(paymentRequest);
GoCardless.Resources.Payment payment = paymentResponse.Payment;
paymentCreateParams := gocardless.PaymentCreateParams{
Amount: 123,
Currency: "GBP",
Reference: "Wine Box",
ChargeDate: "2026-12-31",
Metadata: map[string]interface{}{"internal_order_number": "ID123"},
Links: gocardless.PaymentCreateParamsLinks{
Mandate: "MD123",
},
}

payment, err := client.Payments.Create(context, paymentCreateParams)
curl -X POST "https://api.gocardless.com/payments" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "GoCardless-Version: 2015-07-06" \
-H "Content-Type: application/json" \
-d '{
"payments": {
"amount": 123,
"currency": "GBP",
"reference": "Wine Box",
"charge_date": "2026-12-31",
"links": {
"mandate": "MD123"
},
"metadata": {
"internal_order_number": "ID123"
}
}
}'

Note that the amount needs to be provided in the lowest denomination for the currency (e.g. pence in GBP, cents in EUR).

You can decide to either provide a charge_date (needs to be later than the next_possible_charge_date, as described in the mandates API reference), or let GoCardless create the payment as soon as possible.

You would then be able to see the date that the payment will be taken by looking at the charge_date in the response.

What's next?#