Notifications - Webhooks
This document will guide you on how to correctly integrate Webhooks Notifications within PowerBoard.
This document will guide you on how to correctly integrate Webhook Notifications within PowerBoard.
This document will guide you on how to correctly integrate Webhooks Notifications within PowerBoard.
Before you begin
When sending requests to PowerBoard’s API, you must provide either a Public Key and/or Secret Key depending on your use case.
API keys are generated via PowerBoard’s Merchant Dashboard, in three easy steps:
- Login to the PowerBoard Merchant Dashboard.
- Click on the ‘My Company’ link and proceed to the ‘API and Security’ heading.
- On screen, you’ll see both Public and Secret Key required to send requests to PowerBoard’s API.
Use PowerBoards Notification service to get real-time updates on important events within your integration.
To enable webhook notifications, you will need to register a secure URL to the required events. PowerBoard will then send an automatic response to each
subscribed webhook notifying you when any of these events occur.
Including webhook's into your PowerBoard integration will allow you to get updates on newly created transactions, subscriptions, notifying you of an upcoming card expiry, etc.
PowerBoard requires all webhook URLs within the production environment to be secure via HTTPS.
Below is a list of events that PowerBoard currently send.
Event name | Description |
---|---|
transaction_success | Occurs when a transaction is processed successfully |
transaction_failure | Occurs when a transaction is processed unsuccessfully |
subscription_transaction | Occurs when a transaction is processed successfully via a subscription |
subscription_transaction_failure | Occurs when a transaction is processed unsuccessfully via a subscription |
subscription_creation_success | Occurs when a subscription is created successfully |
subscription_creation_failure | Occurs when a subscription is created unsuccessfully |
subscription_updated | Occurs when a subscription was updated |
subscription_finished | Occurs when a subscription has finished |
subscription_failed | Occurs when a subscription has failed |
refund_requested | Occurs when a refund is requested |
refund_successful | Occurs when a refund is processed successfully |
refund_failure | Occurs when a refund is processed unsuccessfully |
card_expiration_warning | Occurs when a stored card will be expiring in 1 month |
standalone_fraud_check_in_review | Occurs when a standalone Fraud Check is In review |
standalone_fraud_check_success | Occurs when a standalone Fraud Check is successful |
standalone_fraud_check_failed | Occurs when a standalone Fraud Check has failed |
standalone_fraud_check_in_review_approved | Occurs when a standalone Fraud Check in review has been approved |
standalone_fraud_check_in_review_declined | Occurs when a standalone Fraud Check in Review has been declined |
You can find a list of them above.
Create a webhook endpoint on your backend server and setup to receive the event notification.
Register your webhook URL by making a request to our notification's endpoint, registering your webhook URL to the required events.
See below example:
API Endpoint | https://api.preproduction.powerboard.commbank.com.au/v1/notifications |
---|---|
HTTP Method | POST |
Headers | x-user-secret-key- POWERBOARD_SECRET_KEY - This is your PowerBoard API Secret Key. Content-Type - application/jsonContent - Type will always be application/json. |
Request Parameters | type - enum - Type of notification: webhook, email. destination - string - Where to send notification (secure https URL for webhook, email address for email). event - string - Event to trigger a notification. transaction_only - boolean - If true, the payload of an event will include information on the latest transaction only and a charge ID. The rest of the fields will be omitted. By default, it is set to false. notification_service_id: - string - Authentication service ID (secure https:// links only) - Authentication service can be created via the PowerBoard merchant dashboard. |
{
"event": "transaction_success",
"destination": "{{YOUR_WEBHOOK_URL}}",
"type": "webhook",
"transaction_only": true
}
{
"status": 201,
"error": null,
"resource": {
"type": "notification",
"data": {
"transaction_only": true,
"_id": "64cafaf2dd42c226f9b6e0ce",
"type": "webhook",
"event": "transaction_success",
"destination": "{{YOUR_WEBHOOK_URL}}",
"created_at": "2023-08-03T00:55:14.657Z",
"updated_at": "2023-08-03T00:55:14.657Z"
}
}
}
Ensure you are storing the Webhook ID i.e.
resource.data._id
returned in the response. You will be using it to updated/edit the webhook.
To ensure that it is receiving the correct response based on the subscribed event types. You can find steps to test your setup below.
You will need to setup the notification in our production environment as required.
PowerBoards user authentication feature allows you to manage your accounts webhook security by supporting Basic authentication protocols for encoding webhook headers.
With user authentication enabled an authorisation, username, and password will be passed into the header of the webhook notification.
Step 1) Login to the PowerBoard Merchant dashboard using your user login credentials
Step 2) Navigate to Notifications → User Auth → Add New
Step 3) Fill out the Label, Username, and Password fields with your required values.
Step 4) Configure your webhook with the newly created User Authentication, this can be done via the PowerBoard merchant dashboard.
Before going live with your webhook it is important to ensure it is working correctly and as expected. Follow the below steps to test and verify.
Step 1) Ensure the Notification setup steps are completed to correctly setup your PowerBoard webhook.
Step 2) Complete a transaction or event that will trigger the event you are Subscribed to.
Step 3) Verify your webhook endpoint is receiving the correct response with the expected data.
Example Webhook Response
{
"event": "transaction_success",
"data": {
"_id": "64cafb7d61433926cd739445",
"transaction": {
"type": "sale",
"status": "complete",
"_source_ip_address": "140.168.135.2",
"gateway_specific_code": null,
"gateway_specific_description": null,
"error_message": null,
"error_code": null,
"status_code": null,
"status_code_description": null,
"include_authorization": false,
"_id": "64cafb7d61433926cd739446",
"currency": "AUD",
"amount": 59,
"amount_fee": null,
"amount_surcharge": null,
"amount_original": null,
"created_at": "2023-08-03T00:57:33.387Z",
"external_id": "ed89987d-7e11-4d14-8dd8-6f48743307b1:f180a5b0-b282-419b-b40c-b890da66e4cf",
"external_reference": "321500292640"
}
}
}
You can view a list of all notification logs sent by PowerBoard via API, if required. These can be filtered by date, type, event, etc.
See below example:
API Endpoint | https://api.preproduction.powerboard.commbank.com.au/v1/notifications/ |
---|---|
HTTP Method | GET |
Headers | x-user-secret-key- POWERBOARD_SECRET_KEY - This is your PowerBoard API Secret Key. Content-Type - application/json - Content - Type will always be application/json. |
Query Parameters | limit - Pagination parameter to limit output to n , default = 100 , maximum value = 1000 event - Parameter to filter notification events. destination - Parameter to filter by email address or webhook URL. type - Parameter to filter notification by type. Values: email, webhook success - Parameter to filter success or failed notifications. Values: true/false created_at.from - Parameter to filter notifications date range. Format: ISO 8601 (yyyy-mm-ddThh:mm:ss.sssZ) or short type of date (yyyy-mm-dd) or specify time offsets from UTC (yyyy-mm-ddThh:mm:ss+hh:mm). created_at.to - Parameter to filter notifications date range. Format: ISO 8601 (yyyy-mm-ddThh:mm:ss.sssZ) or short type of date (yyyy-mm-dd) or specify time offsets from UTC (yyyy-mm-ddThh:mm:ss+hh:mm) sortkey - Sorting key parameter i.e. created_at sortdirection - Sorting order direction parameter ASC or DESC (DESC by default) |
You can unsubscribe to a notification via our API or via the PowerBoard merchant dashboard.
Step 1) Identify the notification Events and ID’s you would like to unsubscribe to.
Step 2) Make a request to our DELETE notifications endpoint using the notification ID as a Path parameter.
See below example:
API Endpoint | https://api.preproduction.powerboard.commbank.com.au/v1/notifications/{id} |
---|---|
HTTP Method | DELETE |
Headers | x-user-secret-key- POWERBOARD_SECRET_KEY - This is your PowerBoard API Secret Key. Content-Type - application/json - Content - Type will always be application/json. |
Path Parameters | id - YOUR_NOTIFICATION_ID - The ID of the notification provided when initially created |
Step 3) Verify the event notification is longer being received by the registered destination.
Step 1) Login to the PowerBoard merchant dashboard using your merchant user credentials.
Step 2) Using the left-hand side menu, navigate to the Notifications section.
Step 3) Identify the notification you would like to unsubscribe to. You can search through Notification or Event type via the Filters on the top of the page.
Step 4) On the notification you would like to delete. You will find an “Actions” button on the right-hand side of the page. Click this and select “Remove” from the dropdown.
Step 5) Verify the event is no longer triggering a notification to the registered email destination.