Consuming Webhooks

Preczn currently provides webhook event subscriptions for transaction, merchant, and loan status updates.
The overall format of the webhook request will remain consistent, while the value of the data property will contain the object which triggered the webhook event notification.

 

Notification Request Format

When Preczn sends a webhook request, your software will receive the following request body format:

Request Properties:

  • id
    • The unique identifier for the webhook notification.
  • webhookId
    • The unique identifier of the webhook subscription which facilitated this notification.
  • eventType
    • The specific event type which triggered the webhook notification.
  • data
    • The response object which triggered the webhook notification.  

Example transaction.approved webhook notification request body format, where the data property contains the full transaction response object:

{
  "id": "what_6k022ss0jj8vp9g85xv1z357m7",
  "webhookId": "wh_5jg1dx62za981aqkanv3cd99zh",
  "eventType": "transaction.approved",
  "data": {
    "amount": 145,
    "authorization": {
        "approvedAmount": 145,
        "avs": "U",
        "cvv": "M",
        "partial": false,
        "processorCode": "approved_by_network",
        "processorMessage": "Payment complete.",
        "processorTransactionId": "ch_3MeKMMAzKBz0Hugp0OhsoRNi",
        "status": "A"
    },
    "createdOn": "2023-02-22T15:35:57Z",
    "currency": "USD",
    "fee": 0,
    "id": "txn_h1rn8c9nd81y9bkgzax2k2rax",
    "merchantId": "mid_2zyd88xrnr90xskmjmqpd0x1vj",
    "payment": {
        "bin": "432100",
        "brand": "VISA",
        "last4": "0012",
        "type": "CREDIT"
    },
    "plan": {
        "id": "plan_57jaev7pna8nftrkr6xksaastw",
        "name": "Stripe Only Plan"
    },
    "platformId": "pfm_7aj2pxrrcg8zs8x6cxyyrwmyqe",
    "processor": {
        "id": "midCon_6v59stftbs837axmpahj21m8jf",
        "name": "Stripe"
    },
    "type": "sale"
	}
}

Request Authenticity Verification

See Webhook Signature Verification for details on how to utilize the webhook signing secret to validate that the request body received by your software is authentic, from Preczn, and not produced or modified by any other party.

Additionally, you can add a custom HTTP request header to webhook configurations, which can be utilized to provide a header such as an API key or Authorization header value to utilize your HTTP APIs authentication and authorization.