Open a GoCardless collection on an invoice
POST/api/v1/invoices/:invoice_id/gocardless_payment
Opens a SEPA direct-debit collection for the invoice's whole outstanding amount through the company's connected GoCardless account. When the customer has not yet authorized a mandate, an authorization request is emailed to the contact named by contact_id and the collection is returned in pending_authorization; the debit itself follows once the mandate is authorized. The body is optional and is only needed for that first authorization. Requires the gocardless_payment feature and a company whose offer allows sales.
Request
Responses
- 201
- 403
- 409
- 413
- 422
- 429
The collection was opened.
Response Headers
Present, and always true, when this response is the stored reply to an earlier call bearing the same Idempotency-Key, the same body and the same query parameters. No collection was opened by the request that received it. Absent on the call that actually opened one.
The access token does not carry the write scope, the gocardless_payment feature is not enabled for the invoice's workspace, the token's application may not write to this invoice, or the invoice's lifecycle state no longer allows a payment to be recorded against it. Nothing was sent to GoCardless.
This Idempotency-Key cannot serve this request. code says which of three: idempotency_key_reuse - the key already served a different body or different query parameters (except a key stored before query parameters were compared, which compares the body only until it expires), so resend the original request byte for byte under the SAME key to replay it; idempotency_key_consumed - an earlier call bearing this key FINISHED, was refused with operation_failed and may already have reached GoCardless, so the key stays spent for its 24 hours. Nothing is running, so do not poll; idempotency_request_in_progress - an earlier call bearing this key is still running, or ended with its outcome unknown, so retry with the SAME key within its 24 hours, which replays the first call's response once it completes. If it still answers this code, or the 24 hours have passed (the same key then runs the request again), never resend blindly. In every case a GET of this same path proves a collection, never its absence: when GoCardless took the debit but its answer was lost, nothing is recorded here and the GET answers 404 (or shows only an earlier collection) while a debit is open. Retry only under the SAME key with the same body, and send a new key only once the debit's absence is confirmed outside this API (the GoCardless dashboard, or its support): a new key, or a retry after the customer's mandate changed, can debit the buyer twice. No collection was opened by this call in any case.
Request body too large: the JSON body exceeds 4 MiB (4,194,304 bytes), or holds more than 500,000 JSON nodes (structural characters {, [, , and : outside strings) or more than 100,000 objects and arrays ({ and [ outside strings), nests them more than 16 levels deep, or holds an object key path (a key and the keys of the objects around it, summed) longer than 128 bytes or a number longer than 128 bytes, as written. The response has no body; nothing was done.
The request was refused. code says which of two: validation_failed - the Idempotency-Key header is missing, and details.idempotency_key says so; operation_failed - the collection itself was refused and message names the cause (no connected GoCardless account, no customer on the invoice, a collection already in flight, nothing left to collect, no contact to send the authorization to, or a self-billed sale the company received over a regulated network while its offer does not include sales invoicing - this last one is refused before GoCardless is reached and never consumes the key). A missing header never consumes the key. An operation_failed may: this platform cannot tell a refusal decided before the request reached GoCardless from one raised after it, so it holds the key rather than risk a second debit, and a retry bearing that key is answered 409 idempotency_key_consumed. A GET of this same path cannot clear it: when GoCardless took the debit but its answer was lost, nothing is recorded here and the GET answers 404 (or shows only an earlier collection) while a debit is open. The outcome is unknown: send no new key until the debit's absence is confirmed outside this API (the GoCardless dashboard, or its support).
rate_limited: this OAuth application went over the partner API limit, 300 requests per minute per OAuth application, shared by every authenticated operation, every access token of the application and its calls to the MCP endpoint /mcp, which count against the same window. Nothing was done; retry after Retry-After seconds.
Response Headers
Seconds to wait before retrying.