GoCardlessClient API request signing for Outbound Payments.
GoCardlessClient requires ECDSA P-256 (ES256) request signatures for outbound payment endpoints. The signature covers the request target, date, nonce, body digest, and content-type headers.
Setup
# Load your private key (PEM format)
pem = File.read!("private_key.pem")
{:ok, signer} = GoCardlessClient.Signing.new(key_id: "your-key-id", pem: pem)Usage with the HTTP client
{:ok, payment} = GoCardlessClient.Resources.OutboundPayments.create(client, params,
signer: signer,
idempotency_key: GoCardlessClient.new_idempotency_key()
)
Summary
Types
Functions
Creates a new Signing struct from a PEM-encoded private key.
Options
:key_id(required) — the key ID registered in your GoCardlessClient dashboard:pem(required) — PEM-encoded private key binary:algorithm—:ecdsa(default) or:rsa
Like new/1 but raises on error.
@spec sign_headers(t(), String.t(), String.t(), binary()) :: {:ok, [{String.t(), String.t()}]} | {:error, String.t()}
Generates the signing headers for an outgoing request.
Returns {:ok, headers} where headers is a list of {name, value} tuples
to merge into the request headers:
"Date"— RFC 2822 formatted UTC timestamp"Nonce"— 32-char hex random nonce"Digest"—SHA-256=<hex>of the request body"Signature"— the full signature header string