AfroPin Developers
Postman Sign in Get test keys

Change the webhook on a PIN

Attach a webhook to a PIN, or switch it to a different one. Later events for the PIN are sent to the new webhook.

POST https://afropin.com/api/v1/brand/pins/webhook

HMAC-signed request with a unique Idempotency-Key header. Authentication

With an SDK
PHP$afropin->brand->pins->setWebhook($params)
Node.jsafropin.brand.pins.setWebhook(params)
Pythonafropin.brand.pins.set_webhook(params)
Javaafropin.brand().pins().setWebhook(params)

Body parameters

pin_id uuid Required

The PIN pin_id. It must belong to your account and to the mode of your API key.

webhook_id string Required

ID of one of your webhooks in the same mode. Create webhooks in the dashboard under Developers.

Active and disabled PINs can be updated; expired PINs cannot. The webhook receives pin.topped_up, and pin.expired for this PIN. Brand redemptions are not sent to it. Webhooks

Request

{
    "pin_id": "e83f72e0-997c-4ca8-aee8-04a7423a1bd4",
    "webhook_id": "3693382f-d2f0-4966-88f7-26d03c454940"
}

Response 200

{
    "ok": true,
    "data": null
}

Errors

Failed requests return a stable code with a translated message. Branch on code, never on the message.

422 validation_error Some fields are missing or invalid
403 wrong_account_type Your account type cannot use this endpoint
429 rate_limited Too many requests. Wait a moment and try again
404 pin_not_found No PIN has this id
403 pin_expired This PIN has expired
404 invalid_webhook_id No webhook of yours has this webhook_id
500 internal_error Something went wrong on our side. Try again; if it keeps happening, contact support
{
    "ok": false,
    "error": {
        "code": "pin_not_found",
        "message": "No PIN has this id",
        "fields": null
    }
}
All error codes →