How to Subscribe to Webhooks

Need to Know

  • Subscribe to changes in Paytron accounts using the create subscription endpoint.
  • You need to create a subscription for each resource type in the account (e.g. payments, and bills).
  • Resource types match those available as options for Paytron Links (always lowercase, always plural).
  • Any event in the system for that resource will be sent to your specified callback URL.
  • All event messages will include the full resource data, matching the API contract for that resource type.
  • Delivery will be retried with a linear back-off up to 5 times before it's considered failed.

How to Subscribe

Paytron manages subscription at a resource level, with every type of resource (e.g. bills or payments) requiring its own distinct subscription.

Each subscription specifies a callback URL for delivery of webhook messages, along with its own unique client secret. To create a new webhook subscription, send a PUT request to the subscriptions/{resourceType} endpoint.

Subscriptions can share a callback URL, or can have their own unique callback URL.

When successfully creating a new subscription, or replacing an old one, you will receive a unique subscriptionSecret. Make sure you store this securely in your system as you will need it to verify request signatures later.

Receiving Webhook Events

Webhook events will be sent to you any time a subscribed resource is added, modified or removed from the Paytron system.

Each webhook event will contain an event name, indicating what happened, as well as the full data for that resource if it still exists after the operation.

Paytron will attempt delivery of the message 5 times, with a linear back-off, before marking delivery as failed. If you believe you have missed an event, you can use the list events endpoint to retrieve it.

Webhook Event Format

All Paytron webhooks have the same top level JSON structure, with the affected resource provided in the data parameter. The format will match the API contract for the specified resource type.

Note: Paytron Links are not available to webhook events.

The event looks as follows:

{
    "accountId": "1245-6789",
    "resourceType": "payments",
    "resourceId": "1234-5678", // i.e. the payment ID or bill ID
    "eventName": "payment_updated",
    "messageId": "1234-5678",
    "sentAt": "2023-04-11T11:52:12.875Z",
    "data":{
      // API version of your resource
    }
}

Available Events

Payment Events

The table below lists all currently supported payment events, available on resource type payments:

Event NameDescription
payment_createdA new payment has been created in the indicated Paytron account.
payment_deletedA payment has been deleted from the indicated Paytron account.
beneficiary_changedThe beneficiary for this payment has been modified.
payment_amount_changedThe amount for this payment has been modified.
payment_currency_changedThe currency of this payment has been modified.
payment_reference_changedThe reference of this payment has been modified.
payment_pay_date_changedThe payment's pay date has been modified.
payment_reason_changedThe payment reason for this payment has been modified.
payment_purpose_changedThe purpose code for this payment has been modified.
payment_bill_addedThis payment has been associated with a Paytron bill.
payment_bill_removedThis payment's associated with a Paytron bill has been removed.
payment_submitted_for_approvalThis payment has been sent for approval.
payment_approvedAll required approvers have approved this payment and it is free to proceed.
payment_rejectedAn approver has chosen to reject this payment and it cannot proceed.
payment_executedThis payment has been sent for execution.
payment_failedThis payment has failed during execution.
payment_completedThis payment has been accepted by our banking partners and marked complete.
payment_returnedThis payment was completed, however the beneficiary's bank has returned the funds to Paytron.
payment_awaiting_fundsPayment execution was attempted, however the funding wallet does not have sufficient funds.

Bill Events

The table below lists all currently supported bills events, available on the resource type bills:

Event NameDescription
bill_createdA new bill has been created in the indicated Paytron account.
bill_deletedThis bill has been deleted from the indicated Paytron account.
beneficiary_changedThe beneficiary on this bill has been modified.
bill_date_changedThe bill date for this bill has been modified.
bill_due_date_changedThe due date for this bill has been modified.
bill_amount_changedThe total amount on this bill has been modified.
bill_currency_changedThe currency for this bill has been modified.
attachment_addedA new attachment has been added to this bill.
attachment_removedAn attachment has been removed from this bill.
line_item_addedA new line item has been added to this bill.
line_item_removedA line item has been removed from this bill.
line_item_modifiedAn existing line item on this bill has been modified.
bill_submitted_for_approvalThis bill has been sent for approval.
bill_approvedAll required approvers have approved this bill.
bill_rejectedThis bill has been rejected by an approver
bill_paidThis bill has been paid in full.
bill_archivedThis bill has been archived in the Paytron account.
bill_restoredThis bill was previously archived but is now active again.
bill_moved_to_draftThis bill has been moved from another status back to draft.