Skip to main content

Events

Events are the way in which Wompi informs you about something important that has happened without you actively requesting it, by using a webhook. In short, we will do a POST HTTP request to a URL that you specify, with a JSON that contains all the information relartive to the event that happened.

This way, for example, each time that a transaction is approved or rejected, Wompi will inform you about this activity on the event URL that you have setip on your account, so that you can implement the neccessary measures on the business side. You can setuo the URL on our Merchant dashboard.

A URL for each environment

Keep in mind that both in Sandbox and Production, you must set an events URL for each environment. This is done to avoid the accidental mix of Production vs Sandbox data.

Handling an event

Each time that Wompi needs to notify an event to your system it will use the event URL, to which it will make a POST HTTP request which wil contain an object like the one shown below. Your system should respond to this HTTP request with with a status HTTP 200 (the most common successful request status code). The body of the responde that you send will not be imporant, because Wompi will not be utilizing it in any way, so you can respond with an empty body, a JSON object or whatever.

Use HTTPS

When possible, we recommend using HTTPS for the URL event that you specify. This guarantees that the information is encrypted from end to end and that nobody can modify it during the communication process.

Whenever the HTTP status of your response is not 200, Wompi will consider that the event could not be notified correctly and will retry to notify the event again, maximum 3 times during the next 24 hours, until obtaining a 200 response. The first retry will be carried out 30 minutes later, the second at 3 hours and the last after 24 hours.

Event body

Any event that Wompi sends you will always have the same structure:

{
"event": "transaction.updated", // Name of the type of event
"data": {
// Event specific data
},
"sent_at": "2018-07-18T08:35:20.000Z" // Exact date at which the event was notified the first time
}

This way for example in the case of an event transaction.updated, which will indicate that the state of a transaction has changed, and the body of the JSON send to the event URL will look like the following:

{
"event": "transaction.updated",
"data": {
"transaction": {
"id": "01-1532941443-49201",
"amount_in_cents": 4490000,
"reference": "MZQ3X2DE2SMX",
"customer_email": "john.doe@gmail.com",
"currency": "COP",
"payment_method_type": "NEQUI",
"redirect_url": "https://mystore.com.co/payments/redirect",
"status": "APPROVED",
"shipping_address": null,
"payment_link_id": null,
"payment_source_id": null
}
},
"sent_at": "2018-07-20T16:45:05.000Z"
}

Event types

Next you will find a list with the types of event which Wompi uses. This list can grow with time, so we recommend re-reading it regularly.

TypeDescription
transaction.updatedThe state of a transaction has changed, usually to a final state (APPROVED, VOIDED, DECLINED or ERROR)