Webhooks
P2C uses webhooks to update you on the status of your cards and report transaction changes, via API calls. Webhooks report to your system with real-time notifications when an event happens. In P2C, a single registration registers the callback URL for all webhook events. When an event occurs, a webhook is triggered and sends the updates to your system.
Every time an event occurs, P2C reports the webhook data to your endpoint, in JSON format. This eliminates the need to poll the API to discover changes. The full event details are included and sent to your system.
Webhook reports
Call | Description |
---|---|
CardAuthorized | Reports: 1. When a card authorization attempt is completed and the status of the card. 2. When a card was signed up via an iframe. |
CardStatusChanged | Reports if a card changed status to active or inactive. |
Transaction | Reports any transactions. |
TransactionStatusChanged | Reports the changed status of a transaction. |
TransactionCompleted | Reports the completion of a transaction request. This webhook is sent only 1 time. If a transaction has changed after the initial execution, the TransactionStatusChanged webhook will be sent. |
Webhook Responses
Sample response - CardAuthorized
{
"EventId":"53e0d945-4f04-477c-901c-010ee5df73c3",
"EventName":"CardAuthorized",
"Data":{
"RequestId":"101f1ed0-501b-4e69-a081-36a06064bcac",
"CardToken":"W5AXTOSK4AUOVRZ4F9M1G9X5JGZUF4SUMTQBTC",
"Authorized":true,
"ResponseReceived":true,
"ResponseCode":"OK",
"ResponseDescription":"OK",
"Error":null,
"AddressVerified":true,
"Rail":1,
"CustomerReferenceNumber":"1"
}
}
Sample response - TransactionCompleted
{
"EventId":"35ad28ca-b10c-4ce9-8427-0177c9e33759",
"EventName":"TransactionCompleted",
"Data":{
"TransactionId":"7CJ39SA3DC-FA3B-4462-5HC9-FJL532ASLGF0",
"Amount":333.0,
"TransactionRequestedAt":"2022-03-11T10:37:59.4",
"TransactionStatus":2,
"ErrorDescription":"{\r\n \"PushCardID\": \"7CJ39SA3DC-FA3B-4462-5HC9-FJL532ASLGF0\",\r\n \"PaymentSent\": false,\r\n \"ResponseReceived\": false,\r\n \"ResponseCode\": null,\r\n \"ResponseDescription\": null,\r\n \"Network\": null,\r\n \"TransactionDate\": null,\r\n \"Error\": \"Card token not found\",\r\n \"TraceNumber\": null\r\n}",
"CreditCardId":"<CARD TOKEN>",
"Rail":null
}
}
Sample response - CardStatusChanged
{
"EventId": "ce1dbd4f-6830-4c20-ab64-000a946a2cfc",
"EventName": "CardStatusChanged",
"Data": {
"StatusChangedAt": "2022-02-04T15:32:28.7632522Z",
"CreditCardId": "<CARD TOKEN>",
"OldStatus": "active",
"NewStatus": "inactive"
}
}
Sample response - TransactionStatusChanged
{
"EventId": "DC51A5F9-581B-4DE9-B5fB-050994F02716",
"EventName": "TransationStatusChanged",
"Data": {
"TransactionId": "7FI8756BSF53B-FHL5-65SD-GHCW555D7100",
"Amount": 300,
"TransactionRequestedAt": "2022-17T06:34:26.95",
"OldTransactionStatus": "succeeded",
"NewTransactionStatus": "pending",
"StatusChangedAt": "2022-01-09T13:13:35.4068128Z",
"CreditCardId": "<CARD TOKEN>",
"Rail": "mcSend"
}
}
Sample response - Transaction
{
"EventId": "3BF32CD9-7FBE-4A83-90E7-ABC200AC7E7E",
"EventName": "Transaction",
"Data": {
"BatchId": "B18ACCDF-DD86-4979-98A7-4DB74ANXTL4E",
"TotalTransactionsCount": 1,
"FailedTransactionCount": 0,
"InvalidTransactionCount": 1,
"SuccessTransactionCount": 0,
"TransactionInProcessCount": 0,
"RequestedAt": "2022-05-21T14:27:59.447",
"CompletedAt": "2022-05-21T14:28:01.27"
}
}
Updated 5 months ago