The smarter way
Search
K

Webhook

Webhooks are automated messages sent from apps when something happens. They have either payload or message which are sent to a unique URL, essentially the app's phone number or address.
Webhook vs API Webhook is an event-based. It will run when a specific event occurs in the source app. API is request-based. It operates when requests come from other 3rd party apps.
Ottu has auto-trigger HTTP call to webhook_url when payment operation gets happened. For payment event, webhook_url should be included in the payload, so call to webhook_url will be triggered when the payment has been completed and BEFORE redirecting the customer back to merchant website.
In two cases, transactional data will be disclosed on the webhook_url: 1- Payment event authorized, paid, attempted, and failed 2- Payment transaction operation void, capture, refund, and cancel
{
"amount":"15.00",
"currency_code":"SAR",
"extra":{
"flight-number":"43667",
"full_name":"abc"
},
"gateway_account":"credit-card-test",
"gateway_name":"mpgs",
"gateway_response":{
"It will contain the raw pg response sent by the pg to Ottu"
},
"message":"Unable to redirect to the PG",
"reference_number":"stage45F3C",
"result":"error",
"session_id":"8eea795ead6d7cda7d12414bbae6a396adfe4758",
"signature":"ee4a6bb00a75c7541b67d26ebf60243ca5652ef2b459f57c84d5586040952e9c",
"state":"attempted",
"total_authorized_amount":"0.00",
"total_paid_amount":"0.00",
"total_refunded_amount":"0.00",
"total_voided_amount":"0.00"
}
{
"amount":"14.00",
"initiator":{
"email":"[email protected]",
"id":83,
"username":"iitiator"
},
"is_sandbox":false,
"operation":null,
"pg_code":"mpgs-ksa",
"pg_response":{
"It will contain the raw pg response sent by the pg to Ottu."
},
"reference_number":"stageDV37C",
"result":"success",
"source":"input",
"success":true,
"timestamp_utc":"2022-09-07 06:21:46",
"txn":{
"amount":"14.00",
"currency_code":"SAR",
"customer_email":"[email protected]",
"extra":{
"flight-number":"1234",
"full_name":"customer"
},
"order_no":"",
"reference_number":"LEQCJ",
"state":"voided"
}
}
The main differences between the two payloads is: In payment event the result parameter is “error” since it is payload for attempted means it failed at first time of paying trial due to error and triggered another trial for paying, while in payment operation is “success”.
Redirect behavior based on webhook_url response on payment events and payment operation: - status code 200, the customer will be redirected to redirect_url. - status code 201, the customer will be redirected to Ottu payment summary page. - status code any other code, the customer will be redirected to Ottu payment summary page. For this particular case, Ottu can notify on the email, when Enable webhook notifications? Activated.