PHP Code Example

Signing a Request (Example in PHP)

1️⃣ Take the request body:

{
    "amount": {
        "value": "12.50",
        "currency": "EUR"
    },
    "counterparty_alias": {
        "type": "EMAIL",
        "value": "[email protected]"
    },
    "description": "Payment for drinks."
}

2️⃣ Sign it using your private key:

openssl_sign($dataToSign, $signature, $privateKey, OPENSSL_ALGO_SHA256);
$encodedSignature = base64_encode($signature);

3️⃣ Add the signature to the request headers:

X-Bunq-Client-Signature: [your base64-encoded signature]

4️⃣ Send it! 🎉

Last updated

Was this helpful?