Curl OxxoPay® Recurrent
Curl OxxoPay® Recurrent
1. Introduction 2
2. First Steps 2
6. Events 7
6.1 Events for validation and authorization 7
6.1.1 inbound_payment.lookup 8
6.1.2 inbound_payment.payment_attempt 9
6.1.3 Data types 10
6.2 charge.paid 11
7. Errors 13
7.1 Errors List 13
8. Tests in “sandbox” 14
8.1 Trigger the event inbound_payment.lookup 14
8.1.1 Example cURL 14
8.2Trigger the event inbound_payment.payment_attempt 15
8.1.1 Example cURL 15
8.3 Event charge.paid 15
We created OXXO Pay® Recurrent so you can receive recurring payments from your
customers. In this way your clients will be able to pay the number of times they need, and you
authorize.
With OXXO Pay® Recurrent, each of your clients will have a unique reference to make several
payments using the same reference. In contrast, with OXXO Pay® your customers must
continue generating a reference for each purchase.
2. First Steps
First you must create a Customer, which will have a personal and unique reference. With it your
client can go to an OXXO store to make the payment. Once at the store, the cashier will ask
your client for your reference and ask your client for the amount of money he wants to pay.
Conekta, together with your business, will validate the payment and when it’s done, we will
notify you in real time.
Next we show you the new flow of OXXO Pay® Recurrent to start receiving money, remember
to have the support of a programmer for the implementation to be successful.
Now you are ready to generate a unique reference per client. If your business has a mobile app,
remember to choose the bar code option as the main payment method. You must also activate
the numeric reference option, in case your client needs to dictate the number to the OXXO
cashier.
1) Validate that the user's reference is correct and can make payments.
2) Approve the amount that the user wants to pay.
3) Notify a payment.
A Webhook is a system of notifications, where your web platform must define a URL, so that our
API sends HTTP requests and can notify you of the different events that we’re going to specify
later. Therefore, you must create a Webhook from your Admin. In this way you will be activating
the notification of events.
In the Admin. open the main menu of your account, located in the upper right corner, and select
the Webhooks section.
After creating a reference for your clients and adding a Webhook to your Admin, you will be
ready to receive payments.
a. When your customers give the reference to the cashier of the OXXO stores, our platform
will communicate with your system to validate that the reference given by the user in
OXXO is correct, or if it’s a user that you have blocked, our API will send a notification to
the OXXO cashier and the user will not be able to make any charge.
b. After validating the reference, the OXXO cashier will ask your customer what amount
you wish to deposit. For this moment our platform will communicate again with your
system to confirm if you authorize this amount.
c. When you authorize the amount and your client makes the payment, finally our platform
will communicate to notify you that a payment has been made.
All this communication will be made through your webhooks which you must integrate from your
Admin account and format your response.
charge.paid With this event we’ll notify you that the order has
been paid without setbacks.
Upon receiving this event you’ll know that your customer at the OXXO store requesting a
payment and we must validate that the reference / client is valid and can continue with the
payment process, for which we’ll send you the relevant information of that user within the
payload of the event:
{
"object": {
"payment_method": {
"service_name": "OxxoPay",
"barcode_url":"https://barcode/url.png",
"object": "cash_payment",
"type": "oxxo",
"expires_at": 1541289600,
"reference": "8400003726321"
},
"charge_id": "5bb675388a268e0ef4a56a42",
"livemode": true,
"created_at": 0,
"object": "inbound_payment",
"amount": 0,
"currency": "MXN",
"fee": 3480,
"customer_id": "cus_2jP5P8huCTWqcTtrn"
},
"previous_attributes": {}
"livemode": true,
"webhook_status": "not_applicable",
"webhook_logs": [],
"id": "5b438f82583eb80d50b4652c",
"object": "event",
"type": "inbound_payment.lookup",
"created_at": 1531154306
}
When your platform receives this event, you must answer with the approval of the validation of
the reference with the following format:
{
"payable": true,
"min_amount": 5000,
"max_amount": 1000000,
}
payable boolean This property tells us if the validation of this reference ended
successfully or not.
min_amount integer The minimum amount that the user can pay.
max_amount integer The maximum amount that the user can pay.
Once the reference has been validated, your client can proceed to pay and you will receive the
event inbound_payment.payment_attempt.
6.1.2 inbound_payment.payment_attempt
Upon receiving this event you will know that there’s a customer trying to pay at an Oxxo store
and you must give authorization for the payment. In this event you’ll receive the amount that the
user wishes to deposit.
{
"data": {
"object": {
"payment_method": {
"service_name": "OxxoPay",
"barcode_url":
"https://s3.amazonaws.com/cash_payment_barcodes/84000045432316.png",
"object": "cash_payment",
"type": "oxxo",
"expires_at": 1541289600,
"reference": "84000045432316"
},
"charge_id": "5bb6755d8a268e0ed9a56acb",
"livemode": true,
"created_at": 1538684253,
"object": "inbound_payment",
"amount": 110700,
"currency": "MXN",
"fee": 3480,
"customer_id": "cus_2jHUgfTB4pYmjmHpB"
},
"previous_attributes": {}
},
"livemode": true,
"webhook_status": "not_applicable",
"webhook_logs": [],
When receiving this event you must answer by sending the payment authorization
{
"payable": true
}
Parameter Type
service_name String
object String
type String
reference String
charge_id String
livemode Boolean
object String
currency String
customer_id String
livemode Boolean
id String
object String
type String
6.2 charge.paid
With this event we will notify you that the payment was executed without problems and then you
can notify your customers about the success of their payments.
This and only this event is the one that you must use to confirm that a payment has been
made.
{
"data": {
"object": {
"id": "5c0968098a268e02ab8aa3f7",
"livemode": true,
"created_at": 1544120329,
"currency": "MXN",
"description": null,
"reference_id": null,
"failure_code": null,
"failure_message": null,
"monthly_installments": null,
"device_fingerprint": null,
"refunds": [],
"payment_method": {
"barcode": "XXXXXXXXX",
"reference": "XXXXXXXXX",
"barcode_url":
"https://s3.amazonaws.com/cash_payment_barcodes/XXXXXXXXX.png",
"object": "cash_payment",
"type": "oxxo",
"expires_at": 1546732800,
"store_name": "OXXO"
},
"details": {
"name": "Juan Perez",
"phone": null,
"email": "juan_perez@conekta.com",
To test the entire flow of events we provide a special endpoint with which you can trigger these
events and verify that the behavior of your validation and payment authorization rules are
working correctly.
URL: https://api.conekta.io/orders/test
In this way we will be simulating the point of sale of OXXO, carrying out a validation of a
reference.
{
"event_type": "inbound_payment.payment_attempt",
"reference": "99000000001273",
"amount": "10000"
}
After making the payment authorization you‘ll receive an event that the order you requested
was correctly paid and there was no setback. You’ll receive this notification approximately 5
minutes later.
This and only this event is the one you should use to confirm that a payment has been
made.
When you finish confirming that you’re receiving the events and that your business rules are
working, you can change the keys to the private ones and start receiving money from your
customers through OXXO.
Take into account that this is the only event you must use to confirm that a payment has been
made.