{"id":3526,"date":"2021-03-10T17:42:31","date_gmt":"2021-03-10T17:42:31","guid":{"rendered":"https:\/\/documents.openpay.mx\/?p=3526"},"modified":"2022-02-18T16:40:13","modified_gmt":"2022-02-18T16:40:13","slug":"webhooks","status":"publish","type":"post","link":"https:\/\/documents-mx-dev.opdevhm.com\/en\/docs\/webhooks.html","title":{"rendered":"Notifications"},"content":{"rendered":"
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

What is a Webhook?<\/strong><\/p>

The WebHooks let you receive notifications in the web service configured in your account about all the transactions made. For example, this allows you to know when a charge was made to a card or when a deposit has been successful.<\/p>

Note:<\/strong> <\/span>If you would like to handle webhooks through the API, review the reference <\/span><\/em>here<\/span><\/em><\/a><\/p>

Webhook Object<\/h2>

Every time a transaction is made, Openpay will send the registered URLs through a JSON object to receive WebHooks. Openpay can add more fields in the future, or add new values \u200b\u200bto existing fields, so it is recommended that your Webhook can handle unknown additional data.<\/p>

Parameters<\/strong><\/p>

The webhook object contains the following information:<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t

\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

Field<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

Description<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

type<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

string
\nThe type of the event that generated the notification.<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

event_date <\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

timestamp
\nCreation date of the event in ISO8601 format.<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

transaction<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

string
\nThe transaction object related to the event. This is not send in verification type notifications.<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

verification_code<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t

string
\nThe Webhook verification code. This is send only in verification type notifications.<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\t\t\t

All transactions notifications will be send to the URLs you have registered. To distinguish a transaction, use the property type<\/span><\/code><\/p>

Note:<\/strong><\/span> Openpay will attempt to deliver the notification until it gets a success response. This can cause some notifications are sent twice, so you should be prepared to receive the same notification more than once.<\/em><\/span><\/p>

Example:<\/strong><\/p>

{<\/span>\n    \"type\"<\/span> :<\/span> \"charge.succeeded\"<\/span>,<\/span>\n    \"event_date\"<\/span> :<\/span> \"2013-11-22T15:09:38-06:00\"<\/span>,<\/span>\n    \"transaction\"<\/span> :<\/span> {<\/span>\n        \"amount\"<\/span><\/span> :<\/span> 2000.0<\/span>,<\/span>\n        \"authorization\"<\/span> :<\/span> \"801585\"<\/span>,<\/span>\n        \"method\"<\/span> :<\/span> \"card\"<\/span>,<\/span>\n        \"operation_type\"<\/span> :<\/span> \"in\"<\/span>,<\/span>\n        \"transaction_type\"<\/span> :<\/span> \"charge\"<\/span>,<\/span>\n        \"card\"<\/span> :<\/span> {<\/span>\n            \"type\"<\/span> :<\/span> \"debit\"<\/span>,<\/span>\n            \"brand\"<\/span> :<\/span> \"mastercard\"<\/span>,<\/span>\n            \"address\"<\/span> :<\/span> {<\/span>\n               \"line1\"<\/span> :<\/span> \"Calle #1 Interior #2\"<\/span>,<\/span>\n               \"line2\"<\/span> :<\/span> null<\/span><\/strong>,<\/span>\n               \"line3\"<\/span> :<\/span> null<\/span><\/strong>,<\/span>\n               \"state\"<\/span> :<\/span> \"Queretaro\"<\/span>,<\/span>\n               \"city\" <\/span>:<\/span> \"Queretaro\"<\/span>,<\/span>\n               \"postal_code\"<\/span> :<\/span> \"76040\"<\/span>,<\/span>\n               \"country_code\"<\/span> :<\/span> \"MX\"<\/span>\n            },<\/span>\n            \"card_number\"<\/span> :<\/span> \"1881\"<\/span>,<\/span>\n            \"holder_name\"<\/span> :<\/span> \"Card Holder\"<\/span>,<\/span>\n            \"expiration_month\"<\/span> :<\/span> \"10\"<\/span>,<\/span>\n            \"expiration_year\"<\/span> :<\/span> \"14\"<\/span>,<\/span>\n            \"allows_charges\"<\/span> :<\/span> true<\/span><\/strong>,<\/span>\n            \"allows_payouts\"<\/span> :<\/span> true<\/span><\/strong>,<\/span>\n            \"creation_date\"<\/span> :<\/span> \"2013-11-22T15:09:32-06:00\"<\/span>,<\/span>\n            \"bank_name\" <\/span>:<\/span> \"BBVA BANCOMER\"<\/span>,<\/span>\n            \"bank_code\"<\/span> :<\/span> \"012\"<\/span>\n        },<\/span>\n        \"status\" <\/span>:<\/span> \"completed\"<\/span>,<\/span>\n        \"id\"<\/span> :<\/span> \"tlxcm4vprtz74qoenuay\"<\/span>,<\/span>\n        \"creation_date\"<\/span> :<\/span> \"2013-11-22T15:09:33-06:00\"<\/span>,<\/span>\n        \"description\"<\/span> :<\/span> \"Description\"<\/span>,<\/span>\n        \"error_message\"<\/span> :<\/span> null<\/span><\/strong>,<\/span>\n        \"order_id\"<\/span> :<\/span> \"oid_14235\"<\/span>\n    }<\/span>\n}<\/span><\/code><\/pre><\/figure>

Valid Webhook service features<\/h2>