Overview
Webhooks allow your application to receive automatic notifications when certain events occur, eliminating the need to poll the API for updates. These notifications are sent as HTTP POST requests to a URL you specify.Configuring Webhooks
Setting Up Your Webhook URL
To configure your webhook endpoint in the StableMint platform:- Log in to the StableMint customer dashboard at dashboard.stablemint.net
- Navigate to the Developer Hub section and go to the Webhook Handlers tab
- Click on the Create Webhook button (note that there can only be one webhook endpoint per Event Type, therefore the button might be grayed out if there is no available endpoints)
- Enter the URL where you want to receive webhook notifications
Best Practices for Webhook URLs
- Use HTTPS for your webhook endpoint to ensure secure data transmission
- Ensure your webhook endpoint is publicly accessible
- Consider using a dedicated endpoint specifically for handling StableMint webhooks
Webhook Security
Signature Verification
All webhooks sent by StableMint include signature headers that allow you to verify the authenticity of the webhook. This ensures that the webhook was indeed sent by StableMint and that the payload has not been tampered with. Each webhook request includes these headers:Verifying the Signature
To verify the webhook signature:- Extract the
StableMint-TimestampandStableMint-Signatureheaders from the request - Construct the signature payload by concatenating:
<TIMESTAMP>,<REQUEST_BODY><TIMESTAMP>is the value from the StableMint-Timestamp header<REQUEST_BODY>is the raw JSON request body
- Use StableMint’s public RSA key to verify the signature against the constructed payload
- The signature uses RSA-SHA256 with PKCS1 padding
Public Keys for Signature Verification
Use the following public keys to verify webhook signatures:Handling Webhook Notifications
Response Requirements
When StableMint sends a webhook to your endpoint, your server must respond with any 2xx status code (e.g., 200, 201, 202, etc.) to acknowledge receipt. This response informs our system that the webhook was successfully delivered and processed.Retry Mechanism
If your endpoint fails to respond with a 2xx status code, StableMint will reattempt to send the notification following a structured retry policy:
After the 5th unsuccessful retry attempt, the webhook delivery will be marked as failed, and no further attempts will be made.
Webhook Payload Format
Version 2 (Default)
All new webhook integrations use Version 2 by default. In this format, the event payload is wrapped in an envelope containing aneventId for tracking and a data object with the event-specific fields:
Version 1 (Deprecated)
In Version 1, the event payload is sent directly as the request body with theeventId injected as a top-level field alongside the event data:
data field.
Further Considerations
- Due to the nature of HTTP requests, you must implement idempotency logic to handle potential duplicate webhook notifications. Use the
eventIdfield to deduplicate deliveries. - Process webhooks asynchronously without long-running processes to avoid timeouts.
Event Types
StableMint sends webhooks for various events, including:Deposit Events
partner.customer.deposit.created: A new deposit request has been createdpartner.customer.deposit.initiated: A deposit has been initiated by the customerpartner.customer.deposit.submitted: A deposit has been submitted to the payment processorpartner.customer.deposit.accepted: A deposit has been accepted and reconciledpartner.customer.deposit.failed: A deposit has failed to processpartner.customer.deposit.completed: A deposit has been completed and funds are settled
Withdrawal Events
partner.customer.withdrawal.requested: A withdrawal request has been createdpartner.customer.withdrawal.accepted: A withdrawal has been accepted for processingpartner.customer.withdrawal.sent: A withdrawal has been successfully sent to the beneficiarypartner.customer.withdrawal.failed: A withdrawal has failed to process
Transaction Events
transaction.status.changed: A transaction status has changed