Webhooks

Table of contents

  1. Webhooks
  2. Introduction
  3. Adding A Webhook Destination
  4. Webhook Schema
  5. Transaction Webhooks
  6. Subscription Webhooks
  7. Payout Webhooks

Introduction

The platform provides webhooks that will push real-time notifications to your external applications when life-cycle events occur. Webhooks provide a powerful way to track the state of transactions and to implement automated actions from other applications.

Webhooks are particularly useful for:

  • Notifying your application of asynchronous events, such as when a transaction is confirmed or a payout has been successfully sent.
  • Acting as triggers for event-based automations (e.g. integrations, status changes, emails, etc.).

Posfra uses HTTPS to POST these events to your application as a JSON payload. You can then use these notifications to trigger actions in your backend systems.

Adding A Webhook Destination

To add a new URL for receiving webhooks go to Settings -> Webhooks. This endpoint will receive POST requests containing the event data.

Webhook Schema

Webhooks use a following schema. The data property can contain multiple models including a Transaction, Subscription or Payout object.

{
    "event": "Transaction.Created",
    "data": {
        "transaction": {
            ...
        }
    }
}

Transaction Webhooks

  • Transaction.Created - Triggered when the user has been presented with the address to send funds to.
  • Transaction.Detected - Triggered when a Bitcoin transaction has been detected to the address of a ‘Pending’ transaction.
  • Transaction.Accepted - Triggered when a transaction has been accepted (see Transactions for more details on the Accepted state)
  • Transaction.Confirmed - Triggered when a balance has been confirmed by at least 6 blocks in the Bitcoin blockchain. This does not necessarily mean the amount requested has been paid. The balance at this address has been credited to your confirmed balance and can be withdrawn in a payout.
  • Transaction.Failed - Triggered when a transaction has failed to complete. See failureReason property for more details.

Subscription Webhooks

  • Subscription.Created - Triggered when a subscription has been created by the platform.
  • Subscription.Activated - Triggered when the first payment for a subscription has been confirmed.
  • Subscription.Paid - Triggered whenever a payment is recived for a subscription
  • Subscription.Cancelled - Triggered when a subscripton has been canelled manually by a user or automatically by the platform for non-payment.

Payout Webhooks

  • Payout.Created - Triggered when a payout has been created manually or automatically by the platform.
  • Payout.Processing - Triggered when a payout status changes frrom Pending to Processing.
  • Payout.Completed - Triggered when a payout has been successful and a TxID has been saved to the payout model.
  • Payout.Cancelled - Triggered when a payout has been cancelled by a user while it is still pending.

No AI was used in the creation of this documentation.