Getting Started

A webhook, or also known as web callbacks, allows us to provide you with real-time notifications when specific API events are triggered such as successful payment processing, invalid/failed transactions, etc. The type of webhook that you wish to set up can be denoted by the event.name key from the payload details.

To support coins.ph webhooks, 3rd party service needs to implement endpoint for receiving HTTPS requests and provide URL of this endpoint to coins.

Authentication

Each request contains HTTP header with authentication token, endpoint should not accept requests without token.

payload = {
  'event': {
    'name': 'sell_order.released',
    'data': {}
  }
}

headers = {
  'Authorization': 'Token {TOKEN_ASSIGNED_TO_URL}'
}

url = https://your_domain_name/path

response = requests.post(
  url,
  json=payload,
  headers=headers,
  timeout=timeout,
)

Supported types of webhooks

Type of webhook is specified in payload, event.name key.

  • sell_order.released - this would get triggered when a particular sell order has been successfully completed
  • sell_order.refunded - this would get triggered when a particular sell order was rejected and has been refunded to the customer
  • sell_order.expired - this would get triggered when a particular sell order has failed due to exceeding the time limit it should have been processed by
  • sell_order.delivered - this would get triggered when a particular sell order is ready for claiming by the recipient

Format of webhook payload

Each request contains event.name and event.data, generally exact format of data depends on type of event, which can be detected by event.name.

payload = {
  'event': {
    'name': 'sell_order.released',
    'data': {
      'id': 'sell_order_id',
      'currency_amount': '100.00',
      'currency': 'PHP',
      ...
    }
  }
}