Setup Webhook Subscriptions
To start receive webhook notifications, you need to create a webhook subscription for specific event types.
You can see the avaiable event types at Available Webhook Event Types
The reply will include a secret that will be used to verify the authenticity of webhook requests.
Store the returned
secretsecurely. It will be used to and cannot be retrieved later.
Endpoint: Webhook Subscription
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"secret": "your_webhook_secret"
}Manage Webhook Subscriptions
You can manage your webhook subscription by calling the following endpoints:
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"callbackUri": "https://your-application.com/webhook-endpoint",
"callbackMethod": "POST",
"eventType": "LOAN_APPLICATION_UPDATE",
"description": "Notification for loan updates",
"active": true,
"createdAt": "2023-01-01T12:00:00Z"
}Receiving Webhooks
When an event occurs that matches one of your subscriptions, Block Earner will send an HTTP request to your callbackUri with the following:
Request Headers
Content-Type: application/jsonX-API-Signature: A signature for verifying the authenticity of the requestX-Subscription-ID: The ID of the subscription that triggered this webhookX-Event-ID: A unique identifier for this webhook eventX-Event-Type: The type of event (e.g.,LOAN_APPLICATION_APPROVED)
Request Body
The request body will be a JSON object containing details specific to the event type. Each event type has its own payload structure.
Verifying Webhook Signatures
To ensure that webhook requests are genuinely from Block Earner and haven't been tampered with, you should verify the signature included in each request:
- Extract the
X-API-Signatureheader from the request - Concatenate the request body (as a raw string) with your webhook secret
- Compute the SHA-256 hash of this concatenated string
- Compare this hash with the value in the
X-API-Signatureheader
Available Webhook Event Types
Block Earner supports the following webhook event types:
| Event Type | Description |
|---|---|
FIAT_DEPOSIT | Triggered when a fiat deposit is credited to the main account |
CRYPTO_DEPOSIT | Triggered when a crypto deposit is credited to the main account |
LOAN_APPLICATION_UPDATE | Triggered when there is an update for loan application status |
REDRAW_APPLICATION_UPDATE | Triggered when there is an update redraw application status |
ROLLOVER_APPLICATION_UPDATE | Triggered when there is an update on rollover application status |
LOAN_HEALTH_STATUS_UPDATE | Triggered when the loan's health status moved from one group to another |
LOAN_UPDATE | Triggered when there is major change with a loan's security amount of loan balance |
LOAN_DEFAULT_STATUS | A dedicated channel just to monitor the loan enters default notice. Alternatively you can use LOAN_HEALTH_STATUS_UPDATE |
LOAN_CASH_REPAYMENT_CONFIRMED | Triggered when a cash repayment has been successfully made to a loan. The LVR and loan status has been updated. |
LOAN_SECURITY_TOP_UP_CONFIRMED | Triggered when a top up security has been successfully made to a loan. The LVR and loan status has been updated. |
PRE_RECKONING_REPORT | Triggered 1 hour before reckoning for a summary of included reckoning and any deposit required |
POST_RECKONING_REPORT | Triggered immediate after reckoning is completed |
INSUFFICIENT_FIAT_BALANCE | Triggered when the main account doesn't have enough balance to complete fiat repayment or close loan with fiat instantly |
INSUFFICIENT_CRYPTO_BALANCE | Triggered when the main account doesn't have enough balance to complete Top up security instantly |
AUTOMATIC_REPAYMENT_OCCURRED | Triggered when an automatic repayment occurs for a loan |
Test webhook with your own payload
You can use Testing Webhook endpoint to test any payload you need for your webhook subscription.
- Get the webhook subscription ID. If you haven't stored it when you made the subscription you can always get it from Get webhook details endpoint
{
"content": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", // This is your subscription ID
"callbackUri": "https://api.blockearner.com.au/api/v1/public/webhooks/test/200",
"callbackMethod": "POST",
"description": "Optional description of the webhook's purpose.",
"active": true,
"eventType": "FIAT_DEPOSIT"
}
],
"page": {
"size": 0,
"number": 0,
"totalElements": 0,
"totalPages": 0
}
}- Use the Subscription ID and any JSON payload you want to test in the body. You should receive the payload you triggered in your subscribed webhook
{
"userId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"amount": "100.50",
"fiatCurrency": "AUD"
}