Verifying webhook
Verifying Webhook Signatures
Always verify the webhook signature to ensure the payload’s integrity and authenticity.
Fenan Pay signs the webhook payload using a private key. To ensure that the webhook you receive is from Fenan Pay and hasn’t been tampered with, verify the signature using the corresponding public key:
- Test environment:
on dashboard: settings > webhook settings > webhook_pubk_test
- Production environment:
on dashboard: settings > webhook settings > webhook_pubk_prod
How Webhook Signatures Work
Fenan Pay signs the body using private key speified in setting. The signature is sent in the webhook’s signature
field. You should verify the integrity of the payload by comparing the provided signature with the one generated using your webhook’s public key.
Make sure to verify the body as a string (unmodified) because any changes could invalidate the signature.
The cryptographic algorithm and signing mechanism used is SHA256withRSA
with a key length of 2048 bits
.
Webhook Payload Structure
Field | Type | Description |
---|---|---|
event | string | Specifies the type of webhook notification. |
body | string | Contains either a PaymentIntent or WithdrawalIntent as a JSON string, depending on the event type. |
event | string | Specifies the type of webhook notification. which will be found inside the body object. |
Key Points to Remember
- Signature Field: The
signature
field contains the cryptographic signature to verify the authenticity of the webhook body. - body: Ensure you verify the body as a string, as any modifications can lead to a failed verification.