Intro
The Openpay API is designed on REST, therefore you’ll find that URLs are oriented to resources and that HTTP response codes are used to indicate errors in the API.
All the API responses are in JSONformat, including the errors.
In the case to use the existents Openpay API clients (Java, Php, C#, Python, Ruby, NodeJS), the responses are specifically of type defined in the clients and their respective languajes.
API Endpoints
Available resourcers
a) By Merchant
/v1/{MERCHANT_ID}/...
/fees
/fees/{FEE_ID}
/charges
/charges/{TRANSACTION_ID}
/payouts
/payouts/{TRANSACTION_ID}
/cards
/cards/{CARD_ID}
/customers
/customers/{CUSTOMER_ID}
/plans
/plans/{PLAN_ID}
/tokens
/tokens/{TOKEN_ID}
b) By Customer
/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/...
/cards
/cards/{CARD_ID}
/bankaccounts
/bankaccounts/{BANKACCOUNT_ID}
/charges
/charges/{TRANSACTION_ID}
/payouts
/payouts/{TRANSACTION_ID}
/transfers
/transfers/{TRANSACTION_ID}
/subscriptions
/subscriptions/{SUBSCRIPTION_ID}
The Openpay REST API has a test environment (sandbox) and a production environment. For integrating your system with Openpay, use the credentials that were generated when you signed up. Once you are ready to move to production environment and your request is approved, new credentials will be generated for accessing the production environment.
The following URIs are the basis of the endpoints for the supported environments:
- Testing, URI base:
Production:
- Production, URI base:
https://api.openpay.mx
A complete endpoint consists of the base URI of the environment, the identifier of the Merchant and the resource.
For example, if we want to create a new customer, the endpoint would be:
POST https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers
In order to create a complete request is necessary to send the right HTTP headers and the information in JSON format.
Authentication
Authentication example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/charges
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
El parámetro -u se ocupa para realizar la autenticación HTTP Basic (al agregar dos puntos después de la llave privada se previene el uso de contraseña)
Production
Solo es necesario usar la URI base https://api.openpay.mx
Para realizar peticiones a la API de Openpay, es necesario enviar la llave de API (API Key) en todas tus llamadas a nuestros servidores. La llave la puedes obtener desde el dashboard.
There are 2 types of API keys:
- Private.- For calls between servers and full access to all API operations (should never be shared).
- Public.- should only be used in JavaScript calls. This key is only allowed to create cards or create tokens.
For API authentication you must use the basic access authentication, where the API key is the username. The password is not required and it should be left blank for purposes of simplicity
Errors
Openpay returns JSON objects in the service responses.
Error Object
Object example
{
"category" : "request",
"description" : "The customer with id 'm4hqp35pswl02mmc567' does not exist",
"http_code" : 404,
"error_code" : 1005,
"request_id" : "1981cdb8-19cb-4bad-8256-e95d58bc035c",
"fraud_rules": [
"Billing <> BIN Country for VISA/MC"
]
}
Property | Description |
---|---|
category | string request: It means an error caused by data sent by the customer. For example, an invalid request, an attempt of a transaction without funds or a transfer to an account that does not exist.internal: It means an error on the Openpay side, this will occur very rarely.gateway: It means an error during the transaction of funds from one card to the Openpay account or from the to a bank account or card. |
error_code | numeric This is the Openpay error code. |
description | string Error description. |
http_code | string HTTP error code from the response. |
request_id | string Request identifier |
fraud_rules | array Array with antifraud rules broken according to fraud detection rules. |
Error codes
General
Code | HTTP Error | Cause |
---|---|---|
1000 | 500 Internal Server Error | An error happened in the internal Openpay server. |
1001 | 400 Bad Request | The request is not JSON valid format, the fields don’t have the correct format, or the request doesn’t have the required fields. |
1002 | 401 Unauthorized | The request is not authenticated or is incorrect. |
1003 | 422 Unprocessable Entity | The operation could not be completed because the value of one or more of the parameters is incorrect. |
1004 | 503 Service Unavailable | A required service is not available. |
1005 | 404 Not Found | A required resource doesn’t exist. |
1006 | 409 Conflict | There is already a transaction with the same ID order. |
1007 | 402 Payment Required | The funds transfer between the bank account or card and the Openpay account was rejected. |
1008 | 423 Locked | One of the required accounts is deactivated. |
1009 | 413 Request Entity too large | The request body is too large. |
1010 | 403 Forbidden | The public key is being used to make a request that requires the private key, or the private key is being using from Javascript. |
Storage
Code | HTTP Error | Cause |
---|---|---|
2001 | 409 Conflict | The bank account already exists. |
2002 | 409 Conflict | The card with this number is already registered on the customer. |
2003 | 409 Conflict | The external_id already exists. |
2004 | 422 Unprocessable Entity | The check digit card number is invalid according to the Luhn algorithm. |
2005 | 400 Bad Request | The expiration date has expired. |
2006 | 400 Bad Request | The CVV2 security code is required. |
2007 | 412 Precondition Failed | The card number is only valid in sandbox. |
2008 | 412 Precondition Failed | The consulted card is not valid for points. |
2009 | 412 Precondition Failed | The card security code (CVV2) is not valid. |
Cards
Code | HTTP Error | Cause |
---|---|---|
3001 | 402 Payment Required | Card declined. |
3002 | 402 Payment Required | Card is expired. |
3003 | 402 Payment Required | Card has not enough funds. |
3004 | 402 Payment Required | Card has been flagged as stolen. |
3005 | 402 Payment Required | The card has been identified as a fraudulent card. |
3006 | 412 Precondition Failed | The operation is not allowed for this customer or transaction. |
3008 | 412 Precondition Failed | The card is not supported in online transactions. |
3009 | 402 Payment Required | Card has been flagged as lost. |
3010 | 402 Payment Required | The card has been restricted by the bank. |
3011 | 402 Payment Required | The bank has requested to hold this card. Please contact the bank. |
3012 | 412 Precondition Failed | Bank authorization is required to make this payment. |
Accounts
Code | HTTP Error | Cause |
---|---|---|
4001 | 412 Preconditon Failed | The Openpay account doesn’t have enough funds. |
Charges
Charges can be made to cards, stores and banks. Each charge is assigned with an unique identifier in the system.
You can do card charges by using a saved card id, using a token or you can send the card information at the time of invocation.
Cambios por disposiciones oficiales para la prevención de fraude E-commerce
Toda integración que se realice mediante SDK o peticiones directas al API de Openpay, es de carácter obligatorio enviar el header X-Forwarded-For donde se deberá indicar la IP del dispositivo del cliente. En las pestañas de las diferentes tecnologías ubicadas del lado derecho se encuentra la definición de cómo debe ser enviado.
With a card id or token
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/charges
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/charges
Merchant request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/charges
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"source_id" : "kqgykn96i7bcs1wwhvgw",
"method" : "card",
"amount" : 100,
"currency" : "MXN",
"description" : "Cargo inicial a mi cuenta",
"order_id" : "oid-00051",
"device_session_id" : "kR1MiQhz2otdIuUlQkbEyitIqVMiI16f",
"customer" : {
"name" : "Juan",
"last_name" : "Vazquez Juarez",
"phone_number" : "4423456723",
"email" : "juan.vazquez@empresa.com.mx"
}
}'
Response example
{
"id":"trzjaozcik8msyqshka4",
"amount":100.00,
"authorization":"801585",
"method":"card",
"operation_type":"in",
"transaction_type":"charge",
"card":{
"id":"kqgykn96i7bcs1wwhvgw",
"type":"debit",
"brand":"visa",
"address":null,
"card_number":"411111XXXXXX1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":true,
"creation_date":"2014-05-26T11:02:16-05:00",
"bank_name":"Banamex",
"bank_code":"002"
},
"status":"completed",
"currency":"USD",
"exchange_rate" : {
"from" : "USD",
"date" : "2014-11-21",
"value" : 13.61,
"to" : "MXN"
},
"creation_date":"2014-05-26T11:02:45-05:00",
"operation_date":"2014-05-26T11:02:45-05:00",
"description":"Cargo inicial a mi cuenta",
"error_message":null,
"order_id":"oid-00051"
}
This type of charge requires a saved card or a previously generated token. To save cards read Create a card and to use tokens visit the Creation of tokens.
Once you have a saved card or token use the source_id
property to send the identifier.
The device_session_id
property must be generated using JavaScript API, see Fraud detection using device data.
Customized antifraud system
You can send extra data to Openpay in order to increase number of variables and get better results in antifraud detection for your transactions.
Request
Property | Description | ||||||
---|---|---|---|---|---|---|---|
method | string (required) It must contain the card value in order to specify the charge will be made from card. |
||||||
source_id | string (required, length = 45) ID of the saved card or token id created from where the funds will be withdrawn. |
||||||
amount | numeric (required) Amount of charge. Must be an amount greater than zero, with up to two decimal digits. |
||||||
cvv2 | numeric (length = 3 or 4) Security code as it appears on the back of the card. Usually 3 digits. It’s used only charges with Stored Cards. |
||||||
currency | string (optional) Type of currency of charge. At the moment only two types of currencies are supported: Mexican Pesos (MXN) and American Dollars (USD). |
||||||
description | string (required, length = 250) A description associated with the position. |
||||||
order_id | string (required, length = 100) Unique identifier of the position. Must be unique among all transactions. |
||||||
device_session_id | string (required, length = 255) Identifier of the device generated by the antifraud tool. |
||||||
capture | boolean (opcional, default = true) Indicates whether the charge is made immediately or not , when the value is false the charge is handled as authorized (or pre-authorization) and the amount is only to be confirmed or canceled in a second call. |
||||||
customer | object (required) Customer information who is charged. You can use the same parameters used in the creation of a customer but an account for the customer will not be created.Note: Este parámetro solo se puede utilizar creando el cargo a nivel comercioSi desea crear un cliente y llevar un historial de sus cargos consulte como create a customer and do the charge at the customer level. |
||||||
payment_plan | object (optional) Plan data months without interest is desired as use in the charge. Refer to PaymentPlan Object. |
||||||
metadata | list(key, value) (optional) Field list to send antifraud system, It must be according to Rules to send custom antifraud fields. |
||||||
use_card_points | string (optional, default = NONE)
The values that indicate points must be used only if the points_card property is true, otherwise an error will occur. |
||||||
send_email | boolean (optional) Used in redirect charges. Indicates if is need send a email that redirect to the openpay payment form. |
||||||
redirect_url | string (required) Used in redirect charges. It indicates the url to which redirect after a successful transaction in the openpay payment form.Note: Este parámetro solo se puede utilizar si se especifica el manejo de 3D Secure. |
||||||
use_3d_secure | string (optional) Used to specify if 3D Secure should be used. true para manejar 3D Secure. |
Response
Returns a transaction object with the charge information or with an error response..
With redirect
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/charges
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/charges
Merchant request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/charges
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"method" : "card",
"amount" : 100,
"description" : "Cargo inicial a mi cuenta",
"order_id" : "oid-00051",
"customer" : {
"name" : "Juan",
"last_name" : "Vazquez Juarez",
"phone_number" : "4423456723",
"email" : "juan.vazquez@empresa.com.mx"
},
"confirm" : "false",
"send_email":"false",
"redirect_url":"http://www.openpay.mx/index.html"
}'
Response example
{
"id": "trq7yrthx5vc4gtjdkwg",
"authorization": null,
"method": "card",
"operation_type": "in",
"transaction_type": "charge",
"status": "charge_pending",
"conciliated": false,
"creation_date": "2016-09-09T18:52:02-05:00",
"operation_date": "2016-09-09T18:52:02-05:00",
"description": "Cargo desde terminal virtual de 111",
"error_message": null,
"amount": 100,
"currency": "MXN",
"payment_method": {
"type": "redirect",
"url": "https://sandbox-api.openpay.mx/v1/mexzhpxok3houd5lbvz1/charges/trq7yrthx5vc4gtjdkwg/card_capture"
},
"customer": {
"name": "Juan",
"last_name": "Vazquez Juarez",
"email": "juan.vazquez@empresa.com.mx",
"phone_number": "4423456723",
"creation_date": "2016-09-09T18:52:02-05:00",
"clabe": null,
"external_id": null
}
}
This type of charge don’t requires a saved card or a previously generated token
Request
Property | Description |
---|---|
method | string (required in card) It must contain the card value in order to specify the charge will be made from card. |
amount | numeric (required) Amount of charge. Must be an amount greater than zero, with up to two decimal digits. |
description | string (required, length = 250) A description associated with the position. |
order_id | string (required, length = 100) Unique identifier of the position. Must be unique among all transactions. |
customer | object (required) Customer information who is charged. You can use the same parameters used in the creation of a customer but an account for the customer will not be created.Note: Este parámetro solo se puede utilizar creando el cargo a nivel comercioSi desea crear un cliente y llevar un historial de sus cargos consulte como create a customer and do the charge at the customer level. |
confirm | boolean (required in false) Indicates whether the charge is made immediately or not , when the value is false the charge is handled as authorized (or pre-authorization) and the amount is only to be confirmed or canceled in a second call. false indica que se trata de un cargo con terminal virtual. |
send_email | boolean (optional) Indicates if is need send a email that redirect to the openpay payment form. |
redirect_url | string (required) It indicates the url to which redirect after a successful transaction in the openpay payment form. |
Response
Returns a transaction object with the charge information or with an error response..
Charge via store
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/charges
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/charges
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/charges
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"method" : "store",
"amount" : 100,
"description" : "Cargo con tienda",
"order_id" : "oid-00053",
"due_date" : "2014-05-20T13:45:00"
} '
Response example
{
"id":"trnirkiyobo5qfex55ef",
"amount":100.00,
"authorization":null,
"method":"store",
"operation_type":"in",
"transaction_type":"charge",
"status":"in_progress",
"currency":"MXN",
"creation_date":"2014-05-26T13:48:25-05:00",
"operation_date":"2014-05-26T13:48:25-05:00",
"due_date":"2014-05-28T13:45:00-05:00",
"description":"Cargo con tienda",
"error_message":null,
"order_id":"oid-00053",
"customer_id":"ag4nktpdzebjiye1tlze",
"payment_method":{
"type":"store",
"reference":"000020TRNIRKIYOBO5QFEX55EF0100009",
"paybin_reference":"0101990000001065",
"barcode_url":"https://sandbox-api.openpay.mx/barcode/000020TRNIRKIYOBO5QFEX55EF0100009?width=1&height=45&text=false",
"barcode_paybin_url":"https://sandbox-api.openpay.mx/barcode/0101990000001065?width=1&height=45&text=false"
}
}
For payments at a convenience store you should create a charge type request by indicating storeas method. This will generate a response with a reference number and a URL with a barcode, which you must use to create a receipt so your customer can make the payment in one of the convenience stores. The barcode is Code 128 type.
Request
Property | Description |
---|---|
method | string (required) It must contain the store value in order to specify you want to pay at store. |
amount | numeric (required) Amount of charge. Must be an amount greater than zero, with up to two decimal digits. |
description | string (required, length = 250) A description associated with the position. |
order_id | string (required, length = 100) Unique identifier of the position. Must be unique among all transactions. |
due_date | datetime (optional) Fecha de vigencia para hacer el pago en la tienda en formato ISO 8601.Ejemplo (UTC): 2014-08-01T00:50:00Z Note: Del lado del servidor se cambiara a hora centralEjemplo (Central Time): 2014-08-01T11:51:23-05:00 |
customer | object (required) Customer information who is charged. You can use the same parameters used in the creation of a customer but an account for the customer will not be created.Note: Este parámetro solo se puede utilizar creando el cargo a nivel comercioSi desea crear un cliente y llevar un historial de sus cargos consulte como create a customer and do the charge at the customer level. |
Response
Returns a transaction object with the charge information or with an error response..
Charge via bank
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/charges
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/charges
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/charges
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"method" : "bank_account",
"amount" : 100,
"description" : "Cargo con banco",
"order_id" : "oid-00055",
"due_date"
} '
Response example
{
"id":"trnzf2xjwpupjfryyj23",
"amount":100.00,
"authorization":null,
"method":"bank_account",
"operation_type":"in",
"transaction_type":"charge",
"status":"in_progress",
"currency":"MXN",
"creation_date":"2014-05-26T13:51:25-05:00",
"operation_date":"2014-05-26T13:51:25-05:00",
"description":"Cargo con banco",
"error_message":null,
"order_id":"oid-00055",
"customer_id":"ag4nktpdzebjiye1tlze",
"payment_method":{
"type":"bank_transfer",
"agreement" : "1411217",
"bank":"BBVA Bancomer",
"clabe":"012914002014112176",
"name":"11030021342311520255"
}
}
For a charge via bank you must create a charge type request by indicating bank_accountas method. This will generate a response with a Bancomer CIE agreement number, a CLABE account number and a reference, you have to indicate these data in a receipt so your customer can do the wire transfer via SPEI.
Request
Property | Description |
---|---|
method | string (required) It must contain the bank_account value to specify the pay will be made with bank transfer. |
amount | numeric (required) Amount of charge. Must be an amount greater than zero, with up to two decimal digits. |
description | string (required, length = 250) A description associated with the position. |
order_id | string (required, length = 100) Unique identifier of the position. Must be unique among all transactions. |
due_date | datetime (optional) Fecha de vigencia para hacer el cargo a banco en formato ISO 8601.Ejemplo (UTC): 2014-08-01T00:50:00Z Note: Del lado del servidor se cambiara a hora centralEjemplo (Central Time): 2014-08-01T11:51:23-05:00 |
customer | object (optional) Customer information who is charged. You can use the same parameters used in the creation of a customer but an account for the customer will not be created.Note: Este parámetro solo se puede utilizar creando el cargo a nivel comercioSi desea crear un cliente y llevar un historial de sus cargos consulte como create a customer and do the charge at the customer level. |
Response
Returns a transaction object with the charge information or with an error response..
With Alipay
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/charges
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/charges
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/charges
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"description": "Cargo Alipay",
"amount": "2000.00",
"method": "alipay",
"redirect_url" : "http://www.example.com/myRedirectUrl"
} '
Response example
{
"id": "truq1dwjz0kmssvpbrlj",
"authorization": null,
"operation_type": "in",
"method": "alipay",
"transaction_type": "charge",
"status": "charge_pending",
"conciliated": false,
"creation_date": "2018-06-14T12:42:11-05:00",
"operation_date": "2018-06-14T12:42:11-05:00",
"description": "Cargo Alipay",
"error_message": null,
"order_id": null,
"due_date": "2018-06-15T12:42:11-05:00",
"payment_method": {
"type": "redirect",
"url": "https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/charges/truq1dwjo0kmssvqbrlj/redirect/"
},
"amount": 2000,
"currency": "MXN",
"fee": {
"amount": 2.00 ,
"tax": 0,
"currency": "MXN"
}
}
To start a transaction using Alipay you should create a charge type request by indicating alipayas method. This will generate a response with an URL which will redirect the customer to the Alipay website where they can then enter their account details, or scan the QR Code in their mobile app.
Request
Property | Description |
---|---|
method | string (required) It must contain the alipay value in order to specify you want the customer to pay using Alipay. |
amount | numeric (required) Amount of charge. Must be an amount greater than zero, with up to two decimal digits. |
description | string (required, length = 250) A description associated with the position. |
order_id | string (required, length = 100) Unique identifier of the position. Must be unique among all transactions. |
due_date | datetime (optional) Fecha de vigencia para hacer el pago en Alipay en formato ISO 8601. El usuario podría tener hasta 15 minutos adicionales después de esta fecha después de iniciar su sesión para hacer su pago.Ejemplo (UTC): 2014-08-01T00:50:00Z Note: Del lado del servidor se cambiara a hora centralEjemplo (Central Time): 2014-08-01T11:51:23-05:00 |
customer | object Customer information who is charged. You can use the same parameters used in the creation of a customer but an account for the customer will not be created.Note: Este parámetro solo se puede utilizar creando el cargo a nivel comercioSi desea crear un cliente y llevar un historial de sus cargos consulte como create a customer and do the charge at the customer level. |
redirect_url | string (required) It indicates the url to which redirect after a successful transaction in the openpay payment form, when a request is receiven in this url, merchant must get id attribute to request for the transaction final result. |
Response
Returns a transaction object with the charge information or with an error response..
Charge with IVR
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/charges
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/charges
Merchant request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/charges
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"method" : "card",
"confirm": "ivr",
"amount" : 100,
"currency" : "MXN",
"description" : "Cargo IVR",
"order_id" : "oid-00051",
"customer" : {
"name" : "Juan",
"last_name" : "Vazquez Juarez",
"phone_number" : "4423456723",
"email" : "juan.vazquez@empresa.com.mx"
}
}'
Response example
{
"id": "tranxr78lb4i58xaliu2",
"authorization": null,
"operation_type": "in",
"transaction_type": "charge",
"status": "charge_pending",
"conciliated": false,
"creation_date": "2020-10-16T12:22:25-05:00",
"operation_date": "2020-10-16T12:22:25-05:00",
"description": "Cargo IVR",
"error_message": null,
"order_id": "ord-323",
"due_date": "2020-10-17T00:59:59-05:00",
"payment_method": {
"type": "ivr",
"phone_number": "525588969143",
"ivr_key": 676105,
"attempts": 0
},
"amount": 100.00,
"currency": "MXN",
"customer": {
"name": "JUAN",
"last_name": "PEREZ",
"email": "juan.urbina@hotmail.com",
"phone_number": "45155352828",
"address": null,
"creation_date": "2020-10-16T12:22:25-05:00",
"external_id": null,
"clabe": null
},
"method": "card"
}
Customized antifraud system
You can send extra data to Openpay in order to increase number of variables and get better results in antifraud detection for your transactions.
Request
Property | Description |
---|---|
method | string (required) It must contain the card value in order to specify the charge will be made from card. |
confirm | string (required) It must contain the ivr value in order to specify the charge will be confirm from IVR. |
amount | numeric (required) Amount of charge. Must be an amount greater than zero, with up to two decimal digits. |
currency | string (optional) Type of currency of charge. At the moment only two types of currencies are supported: Mexican Pesos (MXN) and American Dollars (USD). |
description | string (required, length = 250) A description associated with the position. |
order_id | string (required, length = 100) Unique identifier of the position. Must be unique among all transactions. |
customer | object (required) Customer information who is charged. You can use the same parameters used in the creation of a customer but an account for the customer will not be created.Note: Este parámetro solo se puede utilizar creando el cargo a nivel comercioSi desea crear un cliente y llevar un historial de sus cargos consulte como create a customer and do the charge at the customer level. |
metadata | list(key, value) (optional) Field list to send antifraud system, It must be according to Rules to send custom antifraud fields. |
send_email | boolean (optional) Used in redirect charges. Indicates if is need send a email that redirect to the openpay payment form. |
Response
Returns a transaction object with the charge information or with an error response..
Confirming a charge
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/charges/{TRANSACTION_ID}/capture
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/charges/{TRANSACTION_ID}/capture
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/charges/tryqihxac3msedn4yxed/capture
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"amount" : 100.00
} '
Response example
{
"id":"tryqihxac3msedn4yxed",
"amount":100.00,
"authorization":"801585",
"method":"card",
"operation_type":"in",
"transaction_type":"charge",
"card":{
"type":"debit",
"brand":"visa",
"address":null,
"card_number":"411111XXXXXX1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":true,
"bank_name":"Banamex",
"bank_code":"002"
},
"status":"completed",
"currency":"MXN",
"creation_date":"2014-05-26T14:00:17-05:00",
"operation_date":"2014-05-26T14:00:17-05:00",
"description":"Cargo inicial a mi cuenta",
"error_message":null,
"order_id":null,
"customer_id":"ag4nktpdzebjiye1tlze"
}
Confirm a charge created with the capture = "false"
property, this method is the second part of the create a charge with a card (id or token) and it can confirm the amount captured on the first call or a lesser amount.
Request
Property | Description |
---|---|
amount | numeric (optional) Amount to confirm. It can be less than or equal to the amount given with up to two decimal digits |
Response
Returns a transaction object with the charge information or with an error response..
Refunding a charge
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/charges/{TRANSACTION_ID}/refund
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/charges/{TRANSACTION_ID}/refund
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/charges/tr6cxbcefzatd10guvvw/refund
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"description" : "devolución",
"amount" : 100.00
} '
Response example
{
"id":"tr6cxbcefzatd10guvvw",
"amount":100.00,
"authorization":"801585",
"method":"card",
"operation_type":"in",
"transaction_type":"charge",
"card":{
"type":"debit",
"brand":"visa",
"address":null,
"card_number":"411111XXXXXX1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":true,
"bank_name":"Banamex",
"bank_code":"002"
},
"status":"completed",
"refund":{
"id":"trcbsmjkroqmjobxqhpb",
"amount":100.00,
"authorization":"801585",
"method":"card",
"operation_type":"out",
"transaction_type":"refund",
"status":"completed",
"currency":"MXN",
"creation_date":"2014-05-26T13:56:21-05:00",
"operation_date":"2014-05-26T13:56:21-05:00",
"description":"devolucion",
"error_message":null,
"order_id":null,
"customer_id":"ag4nktpdzebjiye1tlze"
},
"currency":"MXN",
"creation_date":"2014-05-26T11:56:25-05:00",
"operation_date":"2014-05-26T11:56:25-05:00",
"description":"Cargo inicial a mi cuenta",
"error_message":null,
"order_id":"oid-00052",
"customer_id":"ag4nktpdzebjiye1tlze"
}
You can use this method if you want to make a charge refund to a card. The amount to be returned will be the total charge or a lower amount. Note that the refund may be delayed in the statement of your customer for 1-3 business days.
Request
Property | Description |
---|---|
description | string (optional, length = 250) Text to describe the refund reason. |
amount | numeric (optional) Amount to refund. Must be an amount greater than zero and lesser or equal than the original amount, with up to two decimal digits. |
Response
Returns a transaction object with the charge information or with an error response..
Obtener un cargo
Definition
Comercio
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/charges/{TRANSACTION_ID}
Comercio
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/charges/{TRANSACTION_ID}
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/charges/tr6cxbcefzatd10guvvw
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
{
"id":"tr6cxbcefzatd10guvvw",
"amount":100.00,
"authorization":"801585",
"method":"card",
"operation_type":"in",
"transaction_type":"charge",
"card":{
"type":"debit",
"brand":"visa",
"address":null,
"card_number":"411111XXXXXX1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":true,
"bank_name":"Banamex",
"bank_code":"002"
},
"status":"completed",
"refund":{
"id":"trcbsmjkroqmjobxqhpb",
"amount":100.00,
"authorization":"801585",
"method":"card",
"operation_type":"out",
"transaction_type":"refund",
"status":"completed",
"currency":"MXN",
"creation_date":"2014-05-26T13:56:21-05:00",
"operation_date":"2014-05-26T13:56:21-05:00",
"description":"devolucion",
"error_message":null,
"order_id":null,
"customer_id":"ag4nktpdzebjiye1tlze"
},
"currency":"MXN",
"creation_date":"2014-05-26T11:56:25-05:00",
"operation_date":"2014-05-26T11:56:25-05:00",
"description":"Cargo inicial a mi cuenta",
"error_message":null,
"order_id":"oid-00052",
"customer_id":"ag4nktpdzebjiye1tlze"
}
Returns a transaction object with the charge information or with an error response.
Request
Property | Description |
---|---|
transaction_id | string (required, length = 45) Charge Id. |
Response
Returns a transaction object with the charge information or with an error response..
List of charges
Definition
Comercio
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/charges
Comercio
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/charges
Customer request example
curl -g "https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/charges?creation[gte]=2013-11-01&limit=2"
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
[
{
"id":"tryqihxac3msedn4yxed",
"amount":100.00,
"authorization":"801585",
"method":"card",
"operation_type":"in",
"transaction_type":"charge",
"card":{
"type":"debit",
"brand":"visa",
"address":null,
"card_number":"411111XXXXXX1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":true,
"bank_name":"Banamex",
"bank_code":"002"
},
"status":"completed",
"currency":"MXN",
"creation_date":"2014-05-26T14:00:17-05:00",
"operation_date":"2014-05-26T14:00:17-05:00",
"description":"Cargo inicial a mi cuenta",
"error_message":null,
"order_id":null,
"customer_id":"ag4nktpdzebjiye1tlze"
},
{
"id":"trnzf2xjwpupjfryyj23",
"amount":100.00,
"authorization":null,
"method":"bank_account",
"operation_type":"in",
"transaction_type":"charge",
"status":"in_progress",
"currency":"MXN",
"creation_date":"2014-05-26T13:51:25-05:00",
"operation_date":"2014-05-26T13:51:25-05:00",
"description":"Cargo con banco",
"error_message":null,
"order_id":"oid-00055",
"customer_id":"ag4nktpdzebjiye1tlze",
"payment_method":{
"type":"bank_transfer",
"agreement" : "1411217",
"bank":"BBVA Bancomer",
"clabe":"012914002014112176",
"name":"11030021342311520255"
}
}
]
Gets a list of the charges made by Merchant or customer.
Request
You can search using the following parameters as filters.
Property | Description |
---|---|
order_id | string Unique order id generated by the merchant and associated to the transaction by the order_id field of the charge request. |
creation | date Same as creation date. Format yyyy-mm-dd |
creation[gte] | date After the creation date. Format yyyy-mm-dd |
creation[lte] | date Before the creation date. Format yyyy-mm-dd |
offset | numeric Number of records to skip at the beginning, default 0. |
limit | numeric Number of required records, default 10. |
amount | numeric Same as the amount. |
amount[gte] | numeric Greater than or equal to the amount. |
amount[lte] | numeric Less than or equal to the amount. |
status | TransactionStatus Estado de la transacción (IN_PROGRESS,COMPLETED,REFUNDED,CHARGEBACK_PENDING,CHARGEBACK_ACCEPTED,CHARGEBACK_ADJUSTMENT,CHARGE_PENDING,CANCELLED,FAILED). |
Response
Returns an array of transaction objects charges in descending order by creation date.
Payouts or withdrawals
A payout is the transaction that allows to extract funds from a Openpay account and send the funds to a bank account. Payouts can be made from the accounts of the customers or from the Merchant account.
Payout to a registered id
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/payouts
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/payouts
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/payouts
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"method": "bank_account",
"destination_id": "b3d54sd3mdjf75udjfvoc",
"amount": 10.50,
"description": "Retiro de saldo semanal",
"order_id": "oid-00021"
}'
Response example
{
"amount":10.5,
"authorization":null,
"method":"bank_account",
"currency":"MXN",
"operation_type":"out",
"transaction_type":"payout",
"bank_account":{
"id":"b3d54sd3mdjf75udjfvoc",
"clabe":"012XXXXXXXXXX24616",
"bank_code":"012",
"bank_name":"BANCOMER",
"alias":null,
"holder_name":"Mi empresa"
},
"status":"in_progress",
"id":"tm50pl40gf6awvalw1ei",
"creation_date":"2013-11-15T13:42:00-06:00",
"description":"Retiro de saldo semanal",
"error_message":null,
"order_id":"oid-00021",
"customer_id":"aayr5jjb1fln44yautef"
}
Sends a payout to a previously registered bank account. Refer to create a bank account
Request
Property | Description |
---|---|
method | string (required) It must contain the bank_account. |
destination_id | string (required, length = 45) ID of the registered bank account. |
amount | numeric (required) Amount of charge. Must be an amount greater than zero, with up to two decimal digits. |
description | string (required, length = 250) A description associated with the position. |
order_id | string (required, length = 100) Unique identifier of the position. Must be unique among all transactions. |
Response
Returns a transaction object with the payout information or with an error response..
Payment to a bank account
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/payouts
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/payouts
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/asynwirguzkgq2bizogo/payouts
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"method":"bank_account",
"bank_account":{
"clabe":"012298026516924616",
"holder_name":"Mi empresa"
},
"amount":100.00,
"description":"Retiro de saldo semanal",
"order_id":"oid-1110011"
}'
Response example
{
"id":"tr4f2atubqchinw71vfs",
"amount":10.50,
"authorization":null,
"method":"bank_account",
"operation_type":"out",
"transaction_type":"payout",
"status":"in_progress",
"currency":"MXN",
"creation_date":"2014-05-26T17:23:03-05:00",
"operation_date":"2014-05-26T17:23:03-05:00",
"description":"Retiro de saldo semanal",
"error_message":null,
"order_id":"oid-1110011",
"bank_account":{
"clabe":"012XXXXXXXXXX24616",
"bank_code":"012",
"bank_name":"BANCOMER",
"alias":null,
"holder_name":"Mi empresa"
},
"customer_id":"asynwirguzkgq2bizogo"
}
Sends a payment to a bank account.
Request
Property | Description |
---|---|
method | string (required) It must contain the bank_account. |
bank_account | object (required) Data of the bank account where the funds will be sent.clabe.- CLABE account number where the funds will be sent. holder_name.- Name of the account owner . |
amount | numeric (required) Amount of charge. Must be an amount greater than zero, with up to two decimal digits. |
description | string (required, length = 250) A description associated with the position. |
order_id | string (required, length = 100) Unique identifier of the position. Must be unique among all transactions. |
Response
Returns a transaction object with the payout information or with an error response..
Get a payout
Definition
Comercio
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/payouts/{TRANSACTION_ID}
Comercio
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/payouts/{TRANSACTION_ID}
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/asynwirguzkgq2bizogo/payouts/trwpxhrgfeub9eqdyvqz
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
{
"id":"trwpxhrgfeub9eqdyvqz",
"amount":10.50,
"authorization":"TRWPXHRGFEUB9EQDYVQZ",
"method":"bank_account",
"operation_type":"out",
"transaction_type":"payout",
"bank_account":{
"clabe":"012XXXXXXXXXX24616",
"bank_code":"012",
"bank_name":"BANCOMER",
"alias":null,
"holder_name":"Mi empresa"
},
"status":"completed",
"currency":"MXN",
"creation_date":"2014-05-26T17:04:26-05:00",
"operation_date":"2014-05-26T17:06:28-05:00",
"description":"Retiro de saldo semanal",
"error_message":null,
"order_id":"oid-00021",
"customer_id":"asynwirguzkgq2bizogo"
}
Returns de information of the payout. You must know the payout id.
Request
Property | Description |
---|---|
transaction_id | string (required, length = 45) Id of the payout you want to get. |
Response
Returns a transaction object with the payout information or with an error response..
Cancel a payout
Definition
Comercio
DELETE https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/payouts/{TRANSACTION_ID}
Comercio
DELETE https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/payouts/{TRANSACTION_ID}
Customer request example
curl -X DELETE https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/asynwirguzkgq2bizogo/payouts/trozeipf364jqrsbt3ej
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
{
"id":"trozeipf364jqrsbt3ej",
"amount":10.50,
"authorization":"TROZEIPF364JQRSBT3EJ",
"method":"bank_account",
"operation_type":"out",
"transaction_type":"payout",
"bank_account":{
"clabe":"012XXXXXXXXXX24616",
"bank_code":"012",
"bank_name":"BANCOMER",
"alias":null,
"holder_name":"Mi empresa"
},
"status":"cancelled",
"currency":"MXN",
"creation_date":"2014-05-26T17:04:26-05:00",
"operation_date":"2014-05-26T17:06:28-05:00",
"description":"Retiro de saldo semanal",
"error_message":null,
"order_id":"oid-00021",
"customer_id":"asynwirguzkgq2bizogo"
}
Cancels a payout in in_progress status, it means not yet completed. You must know the payout id.
Request
Property | Description |
---|---|
transaction_id | string (required, length = 45) Payout Id you want to cancel. |
Response
Returns a transaction object with the cancelled payout or with an error response..
List of payouts
Definition
Comercio
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/payouts
Comercio
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/payouts
Request example
curl -g "https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/asynwirguzkgq2bizogo/payouts?creation[gte]=2013-11-01&limit=2&payout_type=AUTOMATIC"
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
[
{
"id":"tr4f2atubqchinw71vfs",
"amount":10.50,
"authorization":"TR4F2ATUBQCHINW71VFS",
"method":"bank_account",
"operation_type":"out",
"transaction_type":"payout",
"status":"completed",
"currency":"MXN",
"creation_date":"2014-05-26T17:23:03-05:00",
"operation_date":"2014-05-26T17:26:27-05:00",
"description":"Retiro de saldo semanal",
"error_message":null,
"order_id":"oid-1110011",
"bank_account":{
"clabe":"012XXXXXXXXXX24616",
"bank_code":"012",
"bank_name":"BANCOMER",
"alias":null,
"holder_name":"Mi empresa"
},
"customer_id":"asynwirguzkgq2bizogo"
},
{
"id":"trwpxhrgfeub9eqdyvqz",
"amount":10.50,
"authorization":"TRWPXHRGFEUB9EQDYVQZ",
"method":"bank_account",
"operation_type":"out",
"transaction_type":"payout",
"bank_account":{
"clabe":"012XXXXXXXXXX24616",
"bank_code":"012",
"bank_name":"BANCOMER",
"alias":null,
"holder_name":"Mi empresa"
},
"status":"completed",
"currency":"MXN",
"creation_date":"2014-05-26T17:04:26-05:00",
"operation_date":"2014-05-26T17:06:28-05:00",
"description":"Retiro de saldo semanal",
"error_message":null,
"order_id":"oid-00021",
"customer_id":"asynwirguzkgq2bizogo"
}
]
Gets a list of payouts made at Merchant or customer level.
Request
You can search using the following parameters as filters.
Property | Description |
---|---|
creation | date Same as creation date. Format yyyy-mm-dd |
creation[gte] | date After the creation date. Format yyyy-mm-dd |
creation[lte] | date Before the creation date. Format yyyy-mm-dd |
offset | numeric Number of records to skip at the beginning, default 0. |
limit | numeric Number of required records, default 10. |
amount | numeric Same as the amount. |
amount[gte] | numeric Greater than or equal to the amount. |
amount[lte] | numeric Less than or equal to the amount. |
payout_type | string (opcional, ALL, AUTOMATIC o MANUAL) Payout type used to filter the transactions |
Response
Returns a list of transaction objects payouts in descending order by creation date.
Summary Payouts
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/reports/payout/{TRANSACTION_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/reports/payout/trwpxhrgfeub9eqdyvqz
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
{
"in": 2700,
"out": 2400,
"charged_adjustments": 0,
"refunded_adjustments": 0
}
Return the summary of the payout. You must know the payout id.
Request
Property | Description |
---|---|
transaction_id | string (required, length = 45) Id of the payout you want to get. |
Response
Returns a summary payouts object with the summary of the payout or a error response..
Summary Payout Object
Object example
{
"in":2700,
"out":2400,
"charged_adjustments":0,
"refunded_adjustments":0
}
Property | Description |
---|---|
in | numeric Total amount in, Must be an amount with up to two decimal digits. |
out | numeric Total amount out, Must be an amount with up to two decimal digits. |
charged_adjustments | numeric Total amount of adjustment charges, Must be an amount with up to two decimal digits. |
refunded_adjustments | numeric Total amount of refund charges, Must be an amount with up to two decimal digits. |
Payout Detail
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/reports/payout/{TRANSACTION_ID}/detail
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/reports/payout/trwpxhrgfeub9eqdyvqz/detail?detail_type=IN
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
[
{
"id": "trqcwapqeilg596zwrvr",
"authorization": "7BXqDL1fjb",
"method": "bank_account",
"operation_type": "in",
"transaction_type": "charge",
"status": "completed",
"conciliated": true,
"creation_date": "2016-09-13T12:57:34-05:00",
"operation_date": "2016-09-13T12:57:34-05:00",
"description": "mexzhpxok3houd5lbvz1",
"error_message": null,
"order_id": null,
"bank_account": {
"clabe": "113XXXXXXXXXX09568",
"bank_code": "113",
"bank_name": "VE POR MAS",
"rfc": "OPE130906HN4",
"holder_name": "persona003"
},
"amount": 700,
"currency": "MXN"
},
{
"id": "tru6lsl6xpvseqp87vjd",
"authorization": "FPVYiN4nyw",
"method": "card",
"operation_type": "in",
"transaction_type": "charge",
"card": {
"type": "debit",
"brand": "mastercard",
"address": null,
"card_number": "555555XXXXXX4444",
"holder_name": "persona003",
"expiration_year": null,
"expiration_month": null,
"allows_charges": false,
"allows_payouts": false,
"bank_name": "MASARI",
"bank_code": "602"
},
"status": "completed",
"conciliated": true,
"creation_date": "2016-09-13T12:57:16-05:00",
"operation_date": "2016-09-13T12:57:16-05:00",
"description": "mexzhpxok3houd5lbvz1",
"error_message": null,
"order_id": null,
"amount": 2000,
"currency": "MXN"
}
]
Returns a list of the transactions involved in a payout. You must know the payout id.
Request
Property | Description |
---|---|
transaction_id | string (required, length = 45) Id of the payout you want to get. |
detail_type | string (IN, OUT, CHARGED_ADJUSTMENTS, REFUNDED_ADJUSTMENTS) The detail type. |
offset | numeric Number of records to skip at the beginning, default 0. |
limit | numeric Number of required records, default 10. |
Response
Returns a list of transaction objects or a error response..
Customers
Customers are Openpay resources that are handled within the Merchant account and can represent users, customers or partners according to the type of Merchant.
You can add cards and bank accounts to the customers so you can make transactions like Charges, Transfers or Payouts.
Customer object
Object example
{
"id":"cz4nkhrlcu9k7qd4lwqx",
"creation_date":"2013-11-08T12:04:46-06:00",
"name":"Rodrigo",
"last_name":"Velazco Perez",
"email":"rodrigo.velazco@payments.com",
"phone_number":"4425667045",
"external_id":"cliente1",
"status":"active",
"balance":103,
"address":{
"line1":"Av. 5 de febrero No. 1080 int Roble 207",
"line2":"Carrillo puerto",
"line3":"Zona industrial carrillo puerto",
"postal_code":"06500",
"state":"Querétaro",
"city":"Querétaro",
"country_code":"MX"
},
"store": {
"reference": "OPENPAY02DQ35YOY7",
"barcode_url": "https://sandbox-api.openpay.mx/barcode/OPENPAY02DQ35YOY7?width=1&height=45&text=false"
},
"clabe": "646180109400423323"
}
Property | Description |
---|---|
id | string Customer unique identifier. |
creation_date | datetime Date and time when the customer was created in ISO 8601 format. |
name | string Name of the customer. |
last_name | string Customer's last name. |
string Last name of the customer. |
|
phone_number | numeric Customer's telephone number. |
status | string Account status of the customer can be active or deleted. If the account is on deleted status, no transaction is allowed. |
balance | numeric Account balance with two decimal digits. |
clabe | numeric CLABE account used to receive funds by transfer from any bank in Mexico. |
address | object Address of the customer. It is usually used as shipping address. |
store | object Contains reference string to go to Store and make deposits, the url to generate barcode is contained too. |
Create a new customer
Definition
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"name": "customer name",
"email": "customer_email@me.com",
"requires_account": false
}'
Response example
{
"id":"anbnldwgni1way3yp2dw",
"name":"customer name",
"last_name":null,
"email":"customer_email@me.com",
"phone_number":null,
"address":null,
"creation_date":"2014-05-20T16:47:47-05:00",
"external_id":null,
"store": {
"reference": "OPENPAY02DQ35YOY7",
"barcode_url": "https://sandbox-api.openpay.mx/barcode/OPENPAY02DQ35YOY7?width=1&height=45&text=false"
},
"clabe": "646180109400423323"
}
Create a customer object.
Request
Property | Description |
---|---|
external_id | string (required, length = 100) Unique external identifier of the customer assigned for the Merchant. |
name | string (required, length = 100) Customer's name(s). |
last_name | string (required, length = 100) Customer's last name. |
string (required, length = 100) Customer's email. |
|
requires_account | boolean (opcional, default = false) Send it with true value if you need to create the customer with an account to manage the balance. |
phone_number | string (required, length = 100) Customer's telephone number. |
address | object (optional) Address of the customer. It is usually used as shipping address. |
Response
Returns a object customer when all the data were sent correctly, or returns an error response. if an error occurred during the creation.
Update a customer
Definition
PUT https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/anbnldwgni1way3yp2dw
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X PUT -d '{
"name": "customer name",
"email": "customer_email@me.com",
"address":{
"city":"Queretaro",
"state":"Queretaro",
"line1":"Calle 10",
"postal_code":"76000",
"line2":"col. san pablo",
"line3":"entre la calle 1 y la 2",
"country_code":"MX"
},
"phone_number":"44209087654"
}'
Response example
{
"id":"anbnldwgni1way3yp2dw",
"name":"customer name",
"last_name":null,
"email":"customer_email@me.com",
"phone_number":"44209087654",
"address":{
"line1":"Calle 10",
"line2":"col. san pablo",
"line3":"entre la calle 1 y la 2",
"state":"Queretaro",
"city":"Queretaro",
"postal_code":"76000",
"country_code":"MX"
},
"store": {
"reference": "OPENPAY02DQ35YOY7",
"barcode_url": "https://sandbox-api.openpay.mx/barcode/OPENPAY02DQ35YOY7?width=1&height=45&text=false"
},
"clabe": "646180109400423323",
"creation_date":"2014-05-20T16:47:47-05:00",
"external_id":null
}
Updates one or more data of the customer.
Request
Property | Description |
---|---|
name | string (required, length = 100) Customer's name(s). |
last_name | string (required, length = 100) Customer's last name. |
string (required, length = 100) Customer's email. |
|
phone_number | string (required, length = 100) Customer's telephone number. |
address | object Address of the customer. It is usually used as shipping address. |
Response
Returns a object customer with the updated info, or returns an error response. if a problem happened while updating.
Get an existing customer
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/anbnldwgni1way3yp2dw
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
Response example
{
"id":"anbnldwgni1way3yp2dw",
"name":"customer name",
"last_name":null,
"email":"customer_email@me.com",
"phone_number":"44209087654",
"address":{
"line1":"Calle 10",
"line2":"col. san pablo",
"line3":"entre la calle 1 y la 2",
"state":"Queretaro",
"city":"Queretaro",
"postal_code":"76000",
"country_code":"MX"
},
"store": {
"reference": "OPENPAY02DQ35YOY7",
"barcode_url": "https://sandbox-api.openpay.mx/barcode/OPENPAY02DQ35YOY7?width=1&height=45&text=false"
},
"clabe": "646180109400423323",
"creation_date":"2014-05-20T16:47:47-05:00",
"external_id":null
}
Gets the current information of an existing customer. You only need to specify the id returned when creating the customer.
Request
Property | Description |
---|---|
id | string (required, length = 45) Unique identifier of the customer. |
Response
If the identifier exists, it returns a object customer with the customer information.
Delete a customer
Definition
DELETE https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/anbnldwgni1way3yp2dw
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X DELETE
Deletes a customer permanently. All the related subscriptions will be canceled. Openpay keeps the operations records.
Request
Property | Description |
---|---|
id | string (required, length = 45) Unique identifier of the customer you want to delete. |
Response
If the customer is deleted correctly, it returns an empty response, if the customer can not be deleted it returns a error object explaining the reason.
List of customers
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers
Request example
curl -g "https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers?creation[gte]=2013-11-01&limit=2"
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
Response example
[{
"id":"cpjdhf754ythr65yu9k7q",
"creation_date":"2013-11-08T12:04:46-06:00",
"name":"Rodrigo",
"last_name":"Velazco Perez",
"email":"rodrigo.velazco@payments.com",
"phone_number":"4425667045",
"status":"active",
"balance":142.5,
"store": {
"reference": "OPENPAY02DQ35YOY7",
"barcode_url": "https://sandbox-api.openpay.mx/barcode/OPENPAY02DQ35YOY7?width=1&height=45&text=false"
},
"clabe": "646180109400423323"
}, {
"id":"cz4nkhrlcu9k7qd4lwqx",
"creation_date":"2013-11-07T14:54:46-06:00",
"name":"Eriberto",
"last_name":"Rodriguez Lopez",
"email":"eriberto.rodriguez@payments.com",
"phone_number":"442",
"status":"active",
"balance":103,
"store": {
"reference": "OPENPAY02DQWERWJ3",
"barcode_url": "https://sandbox-api.openpay.mx/barcode/OPENPAY02DQWERWJ3?width=1&height=45&text=false"
},
"clabe": "646180109400423323"
}]
Returns a list of registered customers, if you want to delimit the result you may use filters.
Request
You can search using the following parameters as filters.
Property | Description |
---|---|
external_id | string Unique customer id generated by the merchant and associated to the customer by the external_id field of the create customer request |
creation | date Same as the customer creation date. Format yyyy-mm-dd |
creation[gte] | date After the customer creation date .Format yyyy-mm-dd |
creation[lte] | date Before the customer creation date.Format yyyy-mm-dd |
offset | numeric Number of records to skip at the beginning, default 0. |
limit | numeric Number of required records, default 10. |
Response
Returns an array of customer object.
Wire transfers
The transfers allow to send funds between accounts of your customers.
Transfers between customers
Definition
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/transfers
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/transfers
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"customer_id" : "dvocf97jd20es3tw5laz",
"amount" : 12.50,
"description" : "Transferencia entre cuentas",
"order_id" : "oid-1245"
}'
Response example
{
"amount":12.50,
"authorization":null,
"method":"customer",
"operation_type":"out",
"currency":"MXN",
"transaction_type":"transfer",
"status":"completed",
"id":"twpmbike2jejex3pahzd",
"creation_date":"2013-11-15T10:33:19-06:00",
"description":"Transferencia entre cuentas",
"error_message":null,
"order_id":"oid-1245",
"customer_id":"a9pvykxz4g5rg0fplze0",
"store": {
"reference": "OPENPAY02DQ35YOY7",
"barcode_url": "https://sandbox-api.openpay.mx/barcode/OPENPAY02DQ35YOY7?width=1&height=45&text=false"
},
"clabe": "646180109400423323"
}
Makes the transfer of funds from one account of the customer to another. The funds will be charged to an origin account and added to a destination account, which will create two transactions.
Request
Property | Description |
---|---|
customer_id | string (required, length = 45) The Openpay ID of the customer you want to send the funds. |
amount | numeric (required) Amount to transfer. It must be an amount greater than one peso with up to two decimal digits. |
description | string (required, length = 250) A description associated to the transfer. |
order_id | string (required, length = 100) Unique identifier of the transfer. It will be assigned to the withdrawal transaction. |
Response
If the transaction is successful, the response will contain a transaction object. This object represents the withdrawal of the account of the current customer. On error, the error object will be returned.
Get a transfer
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/transfers/{TRANSACTION_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/transfers/twpmbike2jejex3pahzd
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
Response example
{
"amount":12.50,
"authorization":null,
"method":"customer",
"operation_type":"out",
"currency":"MXN",
"transaction_type":"transfer",
"status":"completed",
"id":"twpmbike2jejex3pahzd",
"creation_date":"2013-11-15T10:33:19-06:00",
"description":"Transferencia entre cuentas",
"error_message":null,
"order_id":"oid-1245",
"customer_id":"dvocf97jd20es3tw5laz"
}
With the customer identifier and the transfer identifier, you can get the details of the transaction. The output transaction will be on the customer from which the transfer was made, and the entry transaction will be on the customer that received the amount.
Request
Property | Description |
---|---|
customer_id | string (required, length = 45) Identifier of the customer. |
transaction_id | string (required, length = 45) Identifier of the transfer. |
Response
Returns a transaction object
List of transfers
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/transfers
Request example
curl -g "https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/transfers?limit=2"
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
[
{
"amount":130.00,
"authorization":null,
"method":"customer",
"currency":"MXN",
"operation_type":"out",
"transaction_type":"transfer",
"status":"completed",
"id":"a74mbe4e2j5gc6gfahzd",
"creation_date":"2013-09-18T00:31:19-06:00",
"description":"Una descripcion",
"error_message":null,
"order_id":"20131115103317",
"customer_id":"afk4csrazjp1udezj1po"
},
{
"amount":130.00,
"authorization":null,
"method":"customer",
"currency":"MXN",
"operation_type":"in",
"transaction_type":"transfer",
"status":"completed",
"id":"a74mbe4e2j5gc6gfahzd",
"creation_date":"2013-09-18T00:31:19-06:00",
"description":"Una descripcion",
"error_message":null,
"order_id":null,
"customer_id":"agdn58ngcnogqmzruz1i"
}
]
It allows to consult the entry and output transactions of a customer.
Request
You can search using the following parameters as filters.
Property | Description |
---|---|
creation | date Same as creation date. Format yyyy-mm-dd |
creation[gte] | date After the creation date. Format yyyy-mm-dd |
creation[lte] | date Before the creation date. Format yyyy-mm-dd |
offset | numeric Number of records to skip at the beginning, default 0. |
limit | numeric Number of required records, default 10. |
Response
List of transaction objects of the transfers made, each one with the identifier of the customer that made it. The transactions will be listed in descending order by creation date.
Cards
Dentro de la plataforma Openpay podrás agregar tarjetas a la cuenta del cliente, eliminarlas, recuperar alguna en específico y listarlas.
You can store multiple debit and / or credit cards at Merchant or customer level for making charges later without the need to enter the information again.
Card Object
Object example
{
"type":"debit",
"brand":"mastercard",
"address":{
"line1":"Av 5 de Febrero",
"line2":"Roble 207",
"line3":"col carrillo",
"state":"Queretaro",
"city":"Querétaro",
"postal_code":"76900",
"country_code":"MX"
},
"id":"kgipbqixvjg3gbzowl7l",
"card_number":"1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":false,
"creation_date":"2013-12-12T17:50:00-06:00",
"bank_name":"DESCONOCIDO",
"bank_code":"000",
"customer_id":"a2b79p8xmzeyvmolqfja",
"points_card":true
}
Property | Description |
---|---|
id | string Unique identifier of the card. |
creation_date | datetime Date and time when the card was created in ISO 8601 format. |
holder_name | string Name of the cardholder. |
card_number | numeric Card Number, it can be 16 or 19 digits. |
cvv2 | numeric Security code as it appears on the back of the card. Usually 3 digits. |
expiration_month | numeric Expiration month as it appears on the card. |
expiration_year | numeric Expiration year as it appears on the card. |
address | object Billing address of cardholder. |
allows_charges | boolean It allows to know if you can make charges to the card. |
allows_payouts | boolean It allows to know if you can send payments to the card. |
brand | string Card brand: visa, mastercard, carnet or american express. |
type | string Card Type: debit, credit, cash, etc. |
bank_name | string Name of the issuing bank. |
bank_code | string Code of the issuing bank. |
customer_id | string Customer identifier to which the card belongs. If the card is at Merchant level this value is null. |
points_card | boolean Indicates whether the card allows the use of reward points. |
Create a card
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/cards
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/cards
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/cards
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"card_number":"4111111111111111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"cvv2":"110",
"device_session_id" : "kR1MiQhz2otdIuUlQkbEyitIqVMiI16f"
}'
Response example
{
"id":"ktrpvymgatocelsciak7",
"type":"debit",
"brand":"visa",
"card_number":"411111XXXXXX1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":true,
"creation_date":"2014-05-21T17:31:01-05:00",
"bank_name":"Banamex",
"customer_id":"ag4nktpdzebjiye1tlze",
"bank_code":"002"
}
When a card is created the customer must be specified, if the customer is not specified the card will be registered for the Merchant account. Once the card is saved, it can not obtain the number and security code.
When saving a card, an ID will be created which can be used to make card charges, payouts to a card or just for getting the not sensitive card information.
You can use the antifraud system implementation. The device_session_id
property must be generated using JavaScript API, see Fraud detection using device data.
Request
Property | Description |
---|---|
holder_name | string (required, length = 80) Name of the cardholder. |
card_number | numeric (required) Card Number, it can be 16 or 19 digits. |
cvv2 | numeric (required) Security code as it appears on the back of the card. Usually 3 digits. |
expiration_month | numeric (required) Expiration month as it appears on the card. |
expiration_year | numeric (required) Expiration year as it appears on the card. |
device_session_id | string (optional, length = 255) Device identifier generated by antifraud tool. |
address | object Billing address of cardholder. |
Response
Returns a card object when it is created correctly or returns an error response. if an error occurred during the creation.
Create a card with token
Definition
Comercio
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/cards
Cliente
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/cards
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/cards
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"token_id":"tokgslwpdcrkhlgxqi9a",
"device_session_id":"8VIoXj0hN5dswYHQ9X1mVCiB72M7FY9o"
}'
Response example
{
"type":"credit",
"brand":"visa",
"id":"kso4st83wxaibffyt6su",
"card_number":"4242",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"15",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":false,
"creation_date":"2014-02-12T10:57:09-06:00",
"bank_name":"BANCOMER",
"bank_code":"012",
"customer_id":"a2b79p8xmzeyvmolqfja"
}
Creates a card from a token obtained from the browser or from the customer’s device. This way prevents the sensitive card information passes through your servers.
Request
Property | Description |
---|---|
token_id | string (required, length = 45) Token identifier generated in the the browser or in the customer’s device. |
device_session_id | string (required, length = 255) Identifier of the device generated by the antifraud tool. |
Response
Returns a card object
Get a card
Definition
Comercio
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/cards/{CARD_ID}
Cliente
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/cards/{CARD_ID}
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/cards/ktrpvymgatocelsciak7
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
Response example
{
"id":"ktrpvymgatocelsciak7",
"type":"debit",
"brand":"visa",
"card_number":"411111XXXXXX1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":true,
"creation_date":"2014-05-21T17:31:01-05:00",
"bank_name":"Banamex",
"customer_id":"ag4nktpdzebjiye1tlze",
"bank_code":"002"
}
It obtains the details of the card by using its id.
Request
Property | Description |
---|---|
id | string (required, length = 45) Card unique identifier. |
Response
Returns a card object
Card points
Definition
Comercio
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/cards/{CARD_ID}/points
Cliente
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/cards/{CARD_ID}/points
Token
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/tokens/{TOKEN_ID}/points
Customer request example
curl -g "https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/cards/ktrpvymgatocelsciak7/points"
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
[
{
"points_type": "santander",
"remaining_points":"300",
"remaining_mxn":"22.5"
}
]
Returns the card point balance. Is applicable only for Santander, Scotiabank and Bancomer points.
Request
You can get the card points of a merchant or customer using the card id.
Property | Description |
---|---|
id | string (required, length = 45) Card unique identifier. |
Also you can get the card points of a merchant using the token.
Property | Description |
---|---|
id | string (required, length = 45) Identifier token |
Response
Property | Description |
---|---|
points_type | Points type accepted by the card (Santander, Scotiabank or Bancomer) |
remaining_points | Number of remaining points |
remaining_mxn | Balance remaining points in pesos |
Delete a card
Definition
Comercio
DELETE https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/cards/{CARD_ID}
Cliente
DELETE https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/cards/{CARD_ID}
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/cards/ktrpvymgatocelsciak7
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-X DELETE
Deletes a card of the customer or Merchant. After deleting it won’t be possible to make movements with that card, however, all records of the transactions you have made will be kept and will be available on the dashboard.
To remove it is only necessary to provide the card identifier.
Request
Property | Description |
---|---|
id | string (required, length = 45) Card unique identifier. |
Response
If the card is removed correctly the answer is empty, if it can not be deleted a error object explaining the reason.
List of cards
Definition
Comercio
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers
Cliente
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/cards
Customer request example
curl -g "https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/cards?limit=2"
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
[
{
"id":"kxq1rpdymlcpxekvjsxm",
"card_number":"1118",
"holder_name":"Pedro Paramo",
"expiration_year":"15",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":true,
"creation_date":"2013-11-20T09:22:25-06:00",
"bank_name":"BBVA BANCOMER",
"bank_code":"012",
"type":"debit",
"brand":"mastercard"
},
{
"id":"kgjy0jiami01kkpdoywr",
"card_number":"1111",
"holder_name":"Pedro Paramo",
"expiration_year":"15",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":true,
"creation_date":"2013-11-19T13:26:12-06:00",
"bank_name":"BBVA BANCOMER",
"bank_code":"012",
"type":"debit",
"brand":"mastercard"
}
]
Returns a list of registered Merchant or customer cards, if you want to narrow the result you can use filters.
Request
You can search using the following parameters as filters.
Property | Description |
---|---|
creation | date Same as creation date. Format yyyy-mm-dd |
creation[gte] | date After the creation date. Format yyyy-mm-dd |
creation[lte] | date Before the creation date. Format yyyy-mm-dd |
offset | numeric Number of records to skip at the beginning, default 0. |
limit | numeric Number of required records, default 10. |
Response
List of card objects registered according to the parameters provided, sorted by creation date in descending order.
Updating a card
Definition
Comercio
PUT https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/cards/{CARD_ID}
Cliente
PUT https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/cards/{CARD_ID}
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/cards/kysc8pycq8hnlzivk1x4
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X PUT -d '{
"cvv2":"000"
}'
Response example
{
}
Updates the card data from the browser or from the customer’s device. It also allows to send a cvv2 code that will be used in the next transaction done with this card. This prevents sensitive information from passing through your servers.
Request
Property | Description |
---|---|
holder_name | string (optional) Name of the cardholder. |
cvv2 | string (optional) Security code as it appears on the back of the card. Usually 3 digits. |
expiration_month | numeric (optional) Expiration month as it appears on the card. |
expiration_year | numeric (optional) Expiration year as it appears on the card. |
merchant_id | string (conditional) Merchant ID to use to validate this card. Required when using a merchant group. |
Response
Returns an empty JSON object. Please consider that this response may be extended in the future.
Bank Accounts
You can store multiple bank accounts by Merchant or customer for withdraw funds later.
Bank account object
Object example
{
"id":"brppwl9nwmruogk2do0j",
"clabe":"032180000118359719",
"bank_code":"032",
"bank_name":"IXE",
"alias":null,
"holder_name":"Juan Hernández Sánchez",
"creation_date":"2013-11-14T12:29:18-06shell00"
}
Property | Description |
---|---|
id | string ID of the bank account. |
holder_name | string Holder’s full name. |
alias | string Name by which the bank account is identified. |
clabe | string CLABE number assigned to the account. |
bank_name | string Abbreviated name of the bank where the account resides, based on the following catalog of Bank codes. |
bank_code | string Bank code where the account resides, based on the following catalog Bank codes. |
creation_date | datetime Date and time when the bank account was created in ISO 8601 format. |
Create a bank account
Definition
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/bankaccounts
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/bankaccounts
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"clabe":"032180000118359719",
"alias":"Cuenta principal",
"holder_name":"Juan Hernández Sánchez"
}'
Response example
{
"id":"buyj4apkwilpp2jfxr9r",
"clabe":"032XXXXXXXXXX59719",
"bank_code":"032",
"bank_name":"IXE",
"alias":"Cuenta principal",
"holder_name":"Juan Hernández Sánchez",
"creation_date":"2014-05-22T11:02:10-05:00"
}
Creates and assigns a bank account to a specific customer.
Request
Property | Description |
---|---|
holder_name | string (required, length = 80) Holder’s full name. |
alias | string (optional, length = 45) Name by which the bank account is identified. |
clabe | string (required, length = 45) CLABE number assigned to the account. |
Response
Returns a bank account object or an error when a there is a problem.
Get a bank account
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/bankaccounts/{BANK_ACCOUNT_ID}
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/bankaccounts/buyj4apkwilpp2jfxr9r
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
{
"id":"buyj4apkwilpp2jfxr9r",
"clabe":"032XXXXXXXXXX59719",
"bank_code":"032",
"bank_name":"IXE",
"alias":"Cuenta principal",
"holder_name":"Juan Hernández Sánchez",
"creation_date":"2014-05-22T11:02:10-05:00"
}
It obtains the details of the bank account assigned to a customer.
Request
Property | Description |
---|---|
id | string (required, length = 45) Unique identifier of the bank account. |
Response
Returns a bank account object
Delete a bank account
Definition
DELETE https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/bankaccounts/{BANK_ACCOUNT_ID}
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/bankaccounts/buyj4apkwilpp2jfxr9r
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-X DELETE
Deletes the bank account associated with the customer. The transactions that are associated with this account are unchanged and will continue for you to consult them.
Request
Property | Description |
---|---|
id | string (required, length = 45) Unique identifier of the bank account. |
Response
If the bank account is removed correctly the answer is empty, if it can not be deleted a error object explaining the reason.
List of bank accounts
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/bankaccounts
Customer request example
curl -g "https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/bankaccounts?limit=2"
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
[{
"id":"brppwl9nwmruogk2do0j",
"clabe":"032180000118359719",
"bank_code":"032",
"bank_name":"IXE",
"alias":null,
"holder_name":"Juan Hernández Sánchez",
"creation_date":"2013-11-14T12:29:18-06:00"
},
{
"id":"bb0zt72rxoyiwz9jzzai",
"clabe":"012680012426485980",
"bank_code":"012",
"bank_name":"BANCOMER",
"alias":null,
"holder_name":"Juan Hernández Sánchez",
"creation_date":"2013-11-14T18:07:45-06:00"
}]
Returns the details of all the bank accounts of the customer specified on the request.
Request
You can search using the following parameters as filters.
Property | Description |
---|---|
creation | date Same as creation date. Format yyyy-mm-dd |
creation[gte] | date After the creation date. Format yyyy-mm-dd |
creation[lte] | date Before the creation date. Format yyyy-mm-dd |
offset | numeric Number of records to skip at the beginning, default 0. |
limit | numeric Number of required records, default 10. |
Response
List of objetos cuenta bancaria registered according to the parameters provided, sorted by creation date in descending order.
Plans
Plans are an Openpay resource that allows create templates for subscriptions. Using plans you can define the amount and frequency of recurrent charges.
Plan Object
Object example
{
"name": "Curso de ingles",
"status": "active",
"amount": 150,
"currency": "MXN",
"id": "patpflacwilazguj6bem",
"creation_date": "2013-12-13T09:43:52-06:00",
"repeat_every": 1,
"repeat_unit": "month",
"retry_times": 2,
"status_after_retry": "cancelled",
"trial_days": 30
}
Property | Description |
---|---|
id | string Unique plan identifier. |
creation_date | datetime Date and time in which the plan was created in ISO 8601 format. |
name | string Plan name. |
amount | numeric Amount that will be applied once the subscription is charged. It has to be more than zero and it can have up to two decimal places. |
currency | string Currency used in the operation, by default is MXN (Mexican pesos). |
repeat_every | numeric Time units in which the subscription will be charged. For example, repeat_unit=month and repeat_every=2 indicates that it will be charged every 2 months. |
repeat_unit | string Describes the charge unit frequency. It can be weekly(week), monthly(month) or yearly (year). |
retry_times | numeric Number of attempts to try to charge the subscription. When the attempts have been exhausted, the status field is determined by the field status_after_retry. |
status | string Plan status can be active or deleted. If the plan is in deleted state it doesn’t allow to register new subscriptions under this plan but existing subscriptions will be charged. |
status_after_retry | string This field indicates the status in which the subscription will be set once all the charge attempts have been exhausted. It can be unpaid or cancelled. |
trial_days | numeric Number of trial days this subscription will have by default. |
Create a new Plan
Definition
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/plans
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/plans
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"amount": 150.00,
"status_after_retry": "cancelled",
"retry_times": 2,
"name": "Curso de ingles",
"repeat_unit": "month",
"trial_days": "30",
"repeat_every": "1"
}'
Response example
{
"id":"p8e6x3hafqqsbmnoevrt",
"name":"Curso de ingles",
"status":"active",
"amount":150.00,
"currency":"MXN",
"creation_date":"2014-05-22T12:29:31-05:00",
"repeat_every":1,
"repeat_unit":"month",
"retry_times":2,
"status_after_retry":"cancelled",
"trial_days":30
}
Creates a new plan for allowing customers to subscribe.
Request
Property | Description |
---|---|
name | string (required, length = 255) Plan name. |
amount | numeric (required) Amount that will be applied once the subscription is charged. It has to be more than zero and it can have up to two decimal places. |
repeat_every | numeric (required) Time units in which the subscription will be charged. For example, repeat_unit=month and repeat_every=2 indicates that it will be charged every 2 months. |
repeat_unit | numeric (required) Describes the charge unit frequency. It can be weekly(week), monthly(month) or yearly (year). |
retry_times | numeric (optional) Number of attempts to try to charge the subscription. When the attempts have been exhausted, the status field is determined by the field status_after_retry. |
status_after_retry | string (requerido, valores = “UNPAID/CANCELLED”) This field indicates the status in which the subscription will be set once all the charge attempts have been exhausted. It can be unpaid or cancelled. |
trial_days | numeric (required) Number of trial days this subscription will have by default. |
Response
Returns a plan object or an error when a there is a problem.
Update existing plans.
Definition
PUT https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/plans/{PLAN_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/plans/p8e6x3hafqqsbmnoevrt
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X PUT -d '{
"name": "Curso de aleman",
"trial_days": "60"
}'
Response example
{
"id":"p8e6x3hafqqsbmnoevrt",
"name":"Curso de aleman",
"status":"active",
"amount":150.00,
"currency":"MXN",
"creation_date":"2014-05-22T12:29:31-05:00",
"repeat_every":1,
"repeat_unit":"month",
"retry_times":2,
"status_after_retry":"cancelled",
"trial_days":60
}
Updates the plan information. It requires a plan id and only certain fields can be updated.
Request
Property | Description |
---|---|
name | string (optional, length = 80) Plan name. |
trial_days | numeric (optional) Number of trial days this subscription will have by default. |
Response
Returns a plan object with the updated information or an error response. if a problem happened while updating.
Get a plan
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/plans/{PLAN_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/plans/p8e6x3hafqqsbmnoevrt
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
{
"id":"p8e6x3hafqqsbmnoevrt",
"name":"Curso de aleman",
"status":"active",
"amount":150.00,
"currency":"MXN",
"creation_date":"2014-05-22T12:29:31-05:00",
"repeat_every":1,
"repeat_unit":"month",
"retry_times":2,
"status_after_retry":"cancelled",
"trial_days":60
}
It gets the plan details.
Request
Property | Description |
---|---|
id | string (required, length = 45) Plan identifier. |
Response
Returns a plan object
Delete a plan
Definition
DELETE https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/plans/{PLAN_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/plans/p8e6x3hafqqsbmnoevrt
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-X DELETE
When a plan is deleted it won’t allow to create more subscriptions associated with it, however the subscriptions already associated will continue to be charged.
Request
Property | Description |
---|---|
id | string (required, length = 45) Identifier of the plan that will be deleted. |
Response
If the plan is deleted correctly the response will be empty, if it cannot be deleted an error object explaining the reason.
Plan list
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/plans
Request example
curl -g "https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/plans?limit=10"
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
[
{
"name": "Curso de aleman",
"status": "active",
"amount": 150,
"currency": "MXN",
"id": "patpflacwilazguj6bem",
"creation_date": "2013-12-13T09:43:52-06:00",
"repeat_every": 1,
"repeat_unit": "month",
"retry_times": 2,
"status_after_retry": "cancelled",
"trial_days": 60
},
{
"name": "Curso de ingles",
"status": "active",
"amount": 150,
"currency": "MXN",
"id": "pjl7wfryrrd1tznr0fnl",
"creation_date": "2013-12-13T11:36:40-06:00",
"repeat_every": 1,
"repeat_unit": "month",
"retry_times": 2,
"status_after_retry": "cancelled",
"trial_days": 30
}
]
Returns the details of all active plans.
Request
You can search using the following parameters:
Property | Description |
---|---|
creation | date Same as creation date. Format yyyy-mm-dd |
creation[gte] | date After the creation date. Format yyyy-mm-dd |
creation[lte] | date Before the creation date. Format yyyy-mm-dd |
offset | numeric Number of records to skip at the beginning, default 0. |
limit | numeric Number of required records, default 10. |
Response
List of plan objects registered according to the parameters provided, sorted by creation date in descending order.
Subscriptions
Subscriptions allow you to associate a customer and a card so that recurring charges can be made.
In order to subscribe a client it is necessary to first create a plan.
Subscription object
Object example
{
"status": "trial",
"card": {
"type": "debit",
"brand": "mastercard",
"card_number": "1111",
"holder_name": "Juan Perez Ramirez",
"expiration_year": "20",
"expiration_month": "12",
"allows_charges": true,
"allows_payouts": false,
"creation_date": "2013-12-13T12:39:46-06:00",
"bank_name": "DESCONOCIDO",
"customer_id": null,
"bank_code": "000"
},
"id": "svxdm1suclzipbi4pavm",
"cancel_at_period_end": false,
"charge_date": "2014-01-12",
"creation_date": "2013-12-13T12:39:46-06:00",
"current_period_number": 0,
"period_end_date": "2014-01-11",
"trial_end_date": "2014-01-11",
"plan_id": "pjl7wfryrrd1tznr0fnl",
"customer_id": "a2b79p8xmzeyvmolqfja"
}
Property | Description |
---|---|
id | string Unique plan identifier. |
creation_date | datetime Date and time in which the subscription was created using ISO 8601 format. |
cancel_at_period_end | string Indicates if the subscription has been canceled at the end of the period. |
charge_date | numeric Date in which the subscription will be charged. |
current_period_number | string Indicates the current period to be charged. |
period_end_date | numeric Date in which the current period ends, it’s one day before the next charge. |
trial_end_date | string Date in which the trial period ends. One day after this date the first charge is applied. |
plan_id | numeric Plan identifier in which this subscription will be created. |
status | string Subscription status, it can be active, trial, past_due, unpaid or cancelled. If the subscription has a trial period, the trial period is applied, if it doesn’t have or when the trial period ends and the first payment is executed it changes to active. When the charge was unable to be completed it changes to past_due. When all the charge tries has been completed according to the plan configuration it can change to unpaid or cancelled. When it’s marked as unpaid and the subscription wants to be reactivated it’s required to update the subscription payment method(card). In any other case, the status is set to cancelled. |
customer_id | string Customer identifier for the subscription owner. |
card | object Payment method for the subscription. See card object |
Create a new Subscription
Definition
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/subscriptions
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/subscriptions
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"card":{
"card_number":"4111111111111111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"cvv2":"110",
"device_session_id":"kR1MiQhz2otdIuUlQkbEyitIqVMiI16f"
},
"plan_id":"pbi4kb8hpb64x0uud2eb"
}'
Response example
{
"id":"s0gmyor4yqtyv1miqwr0",
"status":"trial",
"card":{
"type":"debit",
"brand":"visa",
"address":null,
"card_number":"411111XXXXXX1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":true,
"bank_name":"Banamex",
"bank_code":"002"
},
"cancel_at_period_end":false,
"charge_date":"2014-06-21",
"creation_date":"2014-05-22T15:56:18-05:00",
"current_period_number":0,
"period_end_date":"2014-06-20",
"trial_end_date":"2014-06-20",
"plan_id":"pbi4kb8hpb64x0uud2eb",
"customer_id":"ag4nktpdzebjiye1tlze"
}
Create a new subscription for an existing customer. You can use an existing card or you can send the info of the card where the charges will be made, in these you can include the property device_session_id
to use the antifraud tool, see Fraud detection using device data.
Request
Property | Description |
---|---|
plan_id | string (required, length = 45) Plan identifier in which this subscription will be created. |
trial_end_date | string (optional, length = 10) Indicates the customer trial end date. If it’s not indicated the plan will be used to calculate it. If the date is in the past it will be interpreted as a subscription with no trial. Format: yyyy-mm-dd. |
source_id | string (required if the card is not sent, length = 45) Card token identifier, or the customer registered card which will be used to charge the subscription. |
card | object (required if the source_id is not present) Payment method for the subscription. See card object |
Response
Returns the created subscription object or an error response. if an error occurred during the creation.
Updating a Subscription
Definition
PUT https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/subscriptions
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/subscriptions/s0gmyor4yqtyv1miqwr0
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X PUT -d '{
"trial_end_date": "2016-01-11",
"card": {
"card_number": "343434343434343",
"holder_name": "Juan Perez Ramirez",
"expiration_year": "20",
"expiration_month": "12",
"cvv2":"1234"
}
}'
Response example
{
"id":"s0gmyor4yqtyv1miqwr0",
"status":"trial",
"card":{
"type":"credit",
"brand":"american_express",
"address":null,
"card_number":"343434XXXXX4343",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":false,
"bank_name":"AMERICAN EXPRESS",
"bank_code":"103"
},
"cancel_at_period_end":false,
"charge_date":"2016-01-12",
"creation_date":"2014-05-22T15:56:18-05:00",
"current_period_number":0,
"period_end_date":"2016-01-11",
"trial_end_date":"2016-01-11",
"plan_id":"pbi4kb8hpb64x0uud2eb",
"customer_id":"ag4nktpdzebjiye1tlze"
}
Updates the information of an active subscription.
Request
Property | Description |
---|---|
cancel_at_period_end | booelan (optional) Indicates if the subscription has been canceled at the end of the period. |
trial_end_date | string (optional, length = 10) Indicates the customer trial end date. If it’s not indicated the plan will be used to calculate it. If the date is in the past it will be interpreted as a subscription with no trial. Format: yyyy-mm-dd. |
source_id | string (optional, length = 45) Card token identifier, or the customer registered card which will be used to charge the subscription. |
card | object (optional) Payment method for the subscription. See card object |
Response
Returns the created subscription object actualizado o una error response. if a problem happened while updating.
Get a Subscription
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/subscriptions/{SUBSCRIPTION_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/subscriptions/s0gmyor4yqtyv1miqwr0
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
{
"id":"s0gmyor4yqtyv1miqwr0",
"status":"trial",
"card":{
"type":"credit",
"brand":"american_express",
"address":null,
"card_number":"343434XXXXX4343",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":false,
"bank_name":"AMERICAN EXPRESS",
"bank_code":"103"
},
"cancel_at_period_end":false,
"charge_date":"2016-01-12",
"creation_date":"2014-05-22T15:56:18-05:00",
"current_period_number":0,
"period_end_date":"2016-01-11",
"trial_end_date":"2016-01-11",
"plan_id":"pbi4kb8hpb64x0uud2eb",
"customer_id":"ag4nktpdzebjiye1tlze"
}
Gets the details of a customer subscription.
Request
Property | Description |
---|---|
id | string (required, length = 45) Subscription identifier. |
Response
Returns a subscription object
Cancel a Subscription
Definition
DELETE https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/subscriptions/{SUBSCRIPTION_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/subscriptions/s0gmyor4yqtyv1miqwr0
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-X DELETE
Immediately cancels a customer subscription. No more charges will be made to the card and all pending charges will be cancelled.
Request
Property | Description |
---|---|
id | string (required, length = 45) Identifier of the plan that will be deleted. |
Response
If the response was successfully cancelled the response will be empty. Otherwise an error object explaining the reason.
Subscription list
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/customers/{CUSTOMER_ID}/subscriptions
Request example
curl -g "https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/customers/ag4nktpdzebjiye1tlze/subscriptions?limit=10"
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
[
{
"id":"s0gmyor4yqtyv1miqwr0",
"status":"trial",
"card":{
"type":"credit",
"brand":"american_express",
"address":null,
"card_number":"343434XXXXX4343",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"allows_charges":true,
"allows_payouts":false,
"bank_name":"AMERICAN EXPRESS",
"bank_code":"103"
},
"cancel_at_period_end":false,
"charge_date":"2016-01-12",
"creation_date":"2014-05-22T15:56:18-05:00",
"current_period_number":0,
"period_end_date":"2016-01-11",
"trial_end_date":"2016-01-11",
"plan_id":"pbi4kb8hpb64x0uud2eb",
"customer_id":"ag4nktpdzebjiye1tlze"
}
]
Returns all the subscriptions active for an specific customer.
Request
You can search using the following parameters:
Property | Description |
---|---|
creation | date Same as creation date. Format yyyy-mm-dd |
creation[gte] | date After the creation date. Format yyyy-mm-dd |
creation[lte] | date Before the creation date. Format yyyy-mm-dd |
offset | numeric Number of records to skip at the beginning, default 0. |
limit | numeric Number of required records, default 10. |
Response
List of subscription objects for a customer. Sort by creation date in descending order.
Fees
If the customer accounts were created to handle their own balance, a fee can be charged which will be shown in the Merchant account.
Charging a Fee
Definition
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/fees
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/fees
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"customer_id" : "dvocf97jd20es3tw5laz",
"amount" : 12.50,
"description" : "Cobro de Comisión",
"order_id" : "oid-1245"
}'
Response example
{
"amount":12.50,
"authorization":null,
"method":"customer",
"operation_type":"out",
"currency":"MXN",
"transaction_type":"fee",
"status":"completed",
"id":"th8tafyrkakdbyry3kxi",
"creation_date":"2013-11-18T10:33:03-06:00",
"description":"Cobro de comisión",
"error_message":null,
"order_id":"oid-1245",
"customer_id":"dvocf97jd20es3tw5laz"
}
Charge a fee to the customer account.
Request
Property | Description |
---|---|
customer_id | string (required, length = 45) The unique identifier of the customer that you want to charge the fee. |
amount | numeric (required) Amount of charge. Must be an amount greater than zero, with up to two decimal digits. |
description | string (required, length = 250) A description associated with the fee charge. |
order_id | string (required, length = 100) Unique fee identifier. It has to be unique among all the transactions. |
Response
The transaction object of the fee including the creation date and id or an error response..
Refund Fee
Definition
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/fees/{TRANSACTION_ID}/refund
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/fees/trzjaozcik8msyqshka4/refund
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"description" : "Devolución de Comisión"
}'
Response example
{
"id": "th8tafyrkakdbyry3kxi",
"authorization": null,
"method": "customer",
"operation_type": "in",
"transaction_type": "refund",
"status": "completed",
"conciliated": true,
"creation_date": "2016-09-06T11:56:57-05:00",
"operation_date": "2016-09-06T11:56:57-05:00",
"description": "devolución de comisión merchant03",
"error_message": null,
"order_id": null,
"customer_id": "ar2btmquidjhykdaztp6",
"amount": 11.11,
"currency": "MXN"
}
Refund a fee to the customer account.
Request
Property | Description |
---|---|
description | string (optional, length = 250) A description associated with the fee charge. |
Response
The transaction object of the refund including the creation date and id or an error response..
Fee list
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/fees
Request example
curl -g "https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/fees?limit=10"
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
[
{
"amount":30.00,
"authorization":null,
"method":"customer",
"operation_type":"out",
"currency":"MXN",
"transaction_type":"fee",
"status":"completed",
"id":"th8tafyrkakdbyry3kxi",
"creation_date":"2013-11-18T10:33:03-06:00",
"description":"Cobro de comisión",
"error_message":null,
"order_id":"oid-1367",
"customer_id":"dvocf97jd20es3tw5laz"
},
{
"amount":12.00,
"authorization":null,
"method":"customer",
"operation_type":"out",
"currency":"MXN",
"transaction_type":"fee",
"status":"completed",
"id":"tdzottaaohuhosf4cdv9",
"creation_date":"2013-11-17T05:35:00-06:00",
"description":"Cobro de comisión",
"error_message":null,
"order_id":"oid-1366",
"customer_id":"afk4csrazjp1udezj1po"
}
]
Returns the details of every fee charged by the Merchant.
Request
It can be done using the following parameters:
Property | Description |
---|---|
creation | date Same as creation date. Format yyyy-mm-dd |
creation[gte] | date After the creation date. Format yyyy-mm-dd |
creation[lte] | date Before the creation date. Format yyyy-mm-dd |
offset | numeric Number of records to skip at the beginning, default 0. |
limit | numeric Number of required records, default 10. |
Response
Returns an array of transaction objects for the charged fees in descending order, each one with the identifier of the customer to whom it was made.
Webhooks
Weebhooks allow to notify a Merchant party when an event has occurred in the platform, so the Merchant can take the corresponding actions.
Webhook Object
Object example
{
"id" : "wxvanstudf4ssme8khmc",
"url" : "http://requestb.in/11vxrsf1",
"user" : "juanito",
"password" : "passjuanito",
"event_types" : [
"charge.refunded",
"charge.failed",
"charge.cancelled",
"charge.created",
"chargeback.accepted"
],
"status":"verified"
}
Property | Description |
---|---|
id | string Unique webhook identifier number. |
url | string Webhook |
user | string User name used for webhook’s basic authentication. |
password | string Password for webhook’s basic authentication. |
event_types | array[string] List of events where the webhook will be triggered. |
status | string Webhook status, it indicates if it’s verified or not (unverified). |
Event | Category | Description |
---|---|---|
charge.refunded | Charges | Reports when there is a charge refund. |
charge.failed | Charges | Reports when a charge failed and it wasn’t applied. |
charge.cancelled | Charges | Reports when a charge is cancelled. |
charge.created | Charges | Reports when a charge is scheduled. |
charge.succeeded | Charges | Reports when a charge is applied. |
charge.rescored.to.decline | Charges | Reports when a charge’ score is recalculated and is declined. |
subscription.charge.failed | Suscripción | Reports when the charge to a subscription fails. |
payout.created | Payments | Reports when a payout has been scheduled for the next day. |
payout.succeeded | Payments | Reports when a payout has been applied. |
payout.failed | Payments | Reports when a payout has failed. |
transfer.succeeded | Wire transfers | Reports when a transfer has been performed between to Openpay accounts. |
fee.succeeded | Fees | Reports when a fee is charged successfully to a customer. |
fee.refund.succeeded | Fees | Reports when a fee has been successfully refunded to a customer. |
spei.received | SPEI | Reports when a payout has been received by SPEI for adding funds to the account. |
chargeback.created | Chargebacks | Reports when a chargeback of a transaction was receive and a transaction has been initiated. |
chargeback.rejected | Chargebacks | Reports when a chargeback has been rejected. |
chargeback.accepted | Chargebacks | Reports when a chargeback has been accepted. |
order.created | Order | Reports when an order is created an scheduled. |
order.activated | Order | Reports when an order is activated. |
order.payment.received | Order | Reports when an order is received. |
order.completed | Order | Reports when an order is completed. |
order.expired | Order | Reports when an order has expired. |
order.cancelled | Order | Reports when an order is canceled. |
order.payment.cancelled | Order | Reports when a payment order is canceled. |
Valid Webhook service features
- Endpoint: Domains only (No IPs). example: https://notifications.merchant.com
- Port: 443/TCP, 1518/TCP, 1519/TCP, 8443/TCP y 10443/TCP
- Protocol: HTTPS/TLS_1.2
- Certificate: Valid (Signed by public CA and match with domain).
Webhook Creation
Definition
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/webhooks
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/webhooks
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"url" : "http://requestb.in/11vxrsf1",
"user" : "juanito",
"password" : "passjuanito",
"event_types" : [
"charge.refunded",
"charge.failed",
"charge.cancelled",
"charge.created",
"chargeback.accepted"
]
}'
Response example
{
"id" : "wkn0t30zfxpmhr5usgfa",
"url" : "http://requestb.in/qt3bq0qt",
"user" : "juanito",
"event_types" : [
"charge.succeeded",
"charge.created",
"charge.cancelled",
"charge.failed"
],
"status" : "verified"
}
When you save webhooks an ID will be generated that can be used to eliminate it or simply get not sensitive webhook information.
At the time of saving the webhook, an id will be generated that can be used to eliminate or simply obtain the non-sensitive information from the webhook.
Request
Property | Description |
---|---|
url | string Webhook |
user | string User name used for webhook’s basic authentication. |
password | string Password for webhook’s basic authentication. |
event_types | array[string] List of events where the webhook will be triggered. |
Response
Returns a webhook object when it was successfully created or an error response if there was an error on creation.
Get a Webhook
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/webhooks/{WEBHOOK_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/webhooks/wxvanstudf4ssme8khmc
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
Response example
{
"id" : "wxvanstudf4ssme8khmc",
"url" : "http://requestb.in/11vxrsf1",
"user" : "juanito",
"event_types" : [
"verification",
"charge.refunded",
"charge.failed",
"charge.cancelled",
"charge.created",
"charge.succeeded",
"subscription.charge.failed",
"payout.created",
"payout.succeeded",
"payout.failed",
"transfer.succeeded",
"fee.succeeded",
"spei.received",
"chargeback.created",
"chargeback.rejected",
"chargeback.accepted"
],
"status" : "verified"
}
Get a list of the webhook details by ID.
Request
Property | Description |
---|---|
id | string (required, length = 45) Unique webhook identifier |
Response
Returns a webhook object
Delete a Webhook
Definition
DELETE https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/webhooks/{WEBHOOK_ID}
Customer request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/webhooks/wxvanstudf4ssme8khmc
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-X DELETE
Delete a webhook from the merchant.
To delete a webhook you only need to provide the ID.
Request
Property | Description |
---|---|
id | string (required, length = 45) Unique webhook identifier |
Response
If the webhook was deleted correctly the response will be empty, if the webhook cannot be deleted an error object explaining the reason.
Webhook list
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/webhooks
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/webhooks
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
Response example
[
{
"id" : "wDashboard185",
"event_types" : [
"verification",
"charge.refunded",
"charge.failed",
"charge.cancelled",
"charge.created",
"charge.succeeded",
"subscription.charge.failed",
"payout.created",
"payout.succeeded",
"payout.failed",
"transfer.succeeded",
"fee.succeeded",
"spei.received",
"chargeback.created",
"chargeback.rejected",
"chargeback.accepted"
],
"url" : "http://requestb.in/11vxrsf1",
"status" : "verified"
},
{
"id" : "wDashboard186",
"event_types" : [
"verification",
"charge.refunded",
"charge.failed",
"charge.cancelled",
"charge.created",
"charge.succeeded",
"subscription.charge.failed"
],
"url" : "http://requestb.in/1fhpiog1",
"status" : "verified"
}
]
Returns a list registered by the merchant.
Request
Response
The list of webhook object registered according to the given parameters.
Tokens
The objective is to created tokens from the user browser or device to capture the card information so this doesn’t go through your server and you can avoid or reduce the PCI certification process.
To use this API functionality we recommend using our JavaScript library for your Web application and our Android and iOS SDK for mobile apps.
Features
- Tokens are created at Merchant level.
- Tokens are not link to any customer.
- After a token has been created it can only be use once to make a charge.
Token Object
Object example
{
"id":"tokfa4swch8gr4icy2ma",
"card":{
"card_number":"1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"04",
"address":{
"line1":"Av 5 de febrero",
"line2":"Roble 207",
"line3":"Queretaro",
"state":"Queretaro",
"city":"Queretaro",
"postal_code":"76900",
"country_code":"MX"
},
"creation_date":"2014-01-30T13:53:11-06:00",
"brand":"visa",
"points_card":false
}
}
Property | Description |
---|---|
id | string Token identifier. This is the ID that you should use to perform operations. |
card | object Card associated with the token. See card object |
Create a new token
Definition
POST https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/tokens
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/tokens
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
-H "Content-type: application/json"
-X POST -d '{
"card_number":"4111111111111111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"cvv2":"110",
"address":{
"city":"Querétaro",
"country_code":"MX",
"postal_code":"76900",
"line1":"Av 5 de Febrero",
"line2":"Roble 207",
"line3":"col carrillo",
"state":"Queretaro"
}
}'
Response example
{
"id":"k1n0mscnjwhxqia8q7cm",
"card":{
"card_number":"411111XXXXXX1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"address":{
"line1":"Av 5 de Febrero",
"line2":"Roble 207",
"line3":"col carrillo",
"state":"Queretaro",
"city":"Querétaro",
"postal_code":"76900",
"country_code":"MX"
},
"creation_date":null,
"brand":"visa"
}
}
To create a token using Openpay you need to send the object with the info that will be stored. Once the token it’s stored, you can’t get the number and secutirty code because this information is encrypted.
Request
Property | Description |
---|---|
holder_name | string (required) Name of the cardholder. |
card_number | numeric (required) Card Number, it can be 16 or 19 digits. |
cvv2 | numeric (required) Security code as it appears on the back of the card. Usually 3 digits. |
expiration_month | numeric (required) Expiration month as it appears on the card. |
expiration_year | numeric (required) Expiration year as it appears on the card. |
address | object (optional) Billing address of cardholder. |
Repuesta
Returns the created token object or an error response. if an error occurred during the creation.
Get a Token
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}/tokens/{TOKEN_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f/tokens/k1n0mscnjwhxqia8q7cm
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
{
"id":"k1n0mscnjwhxqia8q7cm",
"card":{
"card_number":"411111XXXXXX1111",
"holder_name":"Juan Perez Ramirez",
"expiration_year":"20",
"expiration_month":"12",
"address":{
"line1":"Av 5 de Febrero",
"line2":"Roble 207",
"line3":"col carrillo",
"state":"Queretaro",
"city":"Querétaro",
"postal_code":"76900",
"country_code":"MX"
},
"creation_date":null,
"brand":"visa"
}
}
Gets the token details. The ID is required.
Request
Property | Description |
---|---|
id | string (required, length = 45) Token ID |
Response
Returns a token object
Merchant
The merchant object allows you to query info related to your account using the API,
Merchant Object
Object example:
{
"id": "m9lrykwsmljagrfb38rs",
"creationDate": "2013-11-13T16:58:40-06:00",
"name": "Promociones en linea",
"email": "contacto@enlinea.com.mx",
"phone": "(321) 222-2222",
"status": "active",
"balance": 1000,
"clabe": "646180109400000542"
}
Property | Description |
---|---|
id | string Unique identifier assigned on creation. |
creation_date | datetime Creation date of the transaction in format ISO 8601. |
name | string Registered merchant name. |
string Email account registered for the merchant. |
|
phone | string Phone number registered for the merchant. |
status | string Merchant account status, it can be active or deleted. If the account is in deletate status no transactions are allowed. |
balance | numeric Account balance with two decimal digits. |
clabe | numeric Linked CLABE account where funds can be received from any bank in Mexico using SPEI. |
Request a Merchant Object
Definition
GET https://sandbox-api.openpay.mx/v1/{MERCHANT_ID}
Request example
curl https://sandbox-api.openpay.mx/v1/mzdtln0bmtms6o3kck8f
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
{
"name":"Demo Openpay",
"email":"demo@openpay.mx",
"phone":"(442) 258-1039",
"status":"active",
"balance":218.73,
"clabe":"646180109400135624",
"id":"mzdtln0bmtms6o3kck8f",
"creation_date":"2014-01-23T10:45:53-06:00"
}
Returns the merchant account details. Only the unique merchant identifier is required.
Request
Property | Description |
---|---|
id | string (required, length = 45) unique merchant identifier. |
Response
If the identifier is correct it will return a merchant object.
Stores
The object represents a convenience store
Store object
Object example:
{
"id_store": 4913,
"id": 115,
"name": "0503 SAN PABLO -QRO",
"last_update": "2016-02-04T00:52:16-06:00",
"status": "active",
"geolocation": {
"lng": -100.421865,
"lat": 20.618171,
"place_id": "ChIJwSN2wpNa04URsDryLW517lg"
},
"address": {
"line1": "AV. 5 DE FEBRERO KM 7.5 NO 1341",
"line2": "SAN PABLO",
"line3": null,
"state": "QUERETARO",
"city": "QUERETARO",
"postal_code": "76030",
"country_code": "MX"
},
"paynet_chain": {
"name": "EXTRA",
"logo": "http://www.openpay.mx/logotipos/extra.png",
"thumb": "http://www.openpay.mx/thumb/extra.png",
"max_amount": 99999.99
}
}
Property | Description |
---|---|
id_store | string Unique identifier assigned on creation. |
id | string Unique identifier by chain. |
name | datetime Store name. |
last_update | string Last date of update in format ISO 8601. |
geolocation | object Store geographical representation by coordinates, latitude and longitude. |
address | object Store address. |
paynet_chain | object Paynet chain to which it belongs. |
Get list of shops by location
Definition
GET https://api.openpay.mx/stores?latitud={latitud}&longitud={longitud}&kilometers={radio}&amount={monto}
Request example
curl https://api.openpay.mx/stores?latitud=20.618975&longitud=-100.422290&kilometers=1.5&amount=4000
-u sk_e568c42a6c384b7ab02cd47d2e407cab:
Response example
[
{
"id_store": 4913,
"id": 115,
"name": "0503 SAN PABLO -QRO",
"last_update": "2016-02-04T00:52:16-06:00",
"status": "active",
"geolocation": {
"lng": -100.421865,
"lat": 20.618171,
"place_id": "ChIJwSN2wpNa04URsDryLW517lg"
},
"address": {
"line1": "AV. 5 DE FEBRERO KM 7.5 NO 1341",
"line2": "SAN PABLO",
"line3": null,
"state": "QUERETARO",
"city": "QUERETARO",
"postal_code": "76030",
"country_code": "MX"
},
"paynet_chain": {
"name": "EXTRA",
"logo": "http://www.openpay.mx/logotipos/extra.png",
"thumb": "http://www.openpay.mx/thumb/extra.png",
"max_amount": 99999.99
}
},
{
"id_store": 4726,
"id": 68,
"name": "ASTURIANO TECNOLOGICO",
"last_update": "2016-02-04T00:52:16-06:00",
"status": "active",
"geolocation": {
"lng": -100.410136,
"lat": 20.61632,
"place_id": "EktQcm9sIFRlY25vbMOzZ2ljbyBOdGUgOTk5LCBTYW4gUGFibG8sIFNhbnRpYWdvIGRlIFF1ZXLDqXRhcm8sIFFyby4sIE3DqXhpY28"
},
"address": {
"line1": "PROLONGACION TECNOLOGICO NORTE #999",
"line2": "SAN PABLO",
"line3": null,
"state": "QUERETARO",
"city": "QUERETARO",
"postal_code": "76159",
"country_code": "MX"
},
"paynet_chain": {
"name": "EL ASTURIANO",
"logo": "http://www.openpay.mx/logotipos/asturiano.png",
"thumb": "http://www.openpay.mx/thumb/asturiano.png",
"max_amount": 99999.99
}
}
]
Gets the trade account details. Only it required to indicate the unique id of trade to be obtained.
Request
Property | Description |
---|---|
latitud | numeric (required) Latitude of geographical location Store |
longitud | numeric (required) Longitud of geographical location Store |
kilometers | numeric (required) Radius distance in kilometers search |
amount | numeric (required) Purchase amount |
Response
If there are stores close range a settlement with stores found it is returned.
Common Objects
Information for objects shared in request and response.
Transaction Object
Object example:
{
"id":"trehwr2zarltvae56vxl",
"authorization":null,
"transaction_type":"payout",
"operation_type":"out",
"currency":"MXN",
"method":"bank",
"creation_date":"2013-11-14T18:29:35-06:00",
"order_id":"000001",
"status":"in_progress",
"amount":500,
"description":"Pago de ganancias",
"error_message":null,
"customer_id":"afk4csrazjp1udezj1po",
"bank_account":{
"rfc":ONE316015PM1,
"mobile":null,
"alias":null,
"bank_name":"BANCOMER",
"creation_date":"2013-11-14T18:29:34-06:00",
"clabe":"012XXXXXXXXXX24616",
"holder_name":"Juan Tapia Trejo",
"bank_code":"012"
}
}
Property | Description |
---|---|
id | string Unique identifier assigned by Openpay at the moment of creation. |
authorization | string Authorization number created by the processor entity. |
transaction_type | string Transaction type: fee, charge, payout, transfer. |
operation_type | string Operation type in the account: in, out. |
method | string Transaction method type: card, bank o customer. |
creation_date | datetime Creation date of the transaction in format ISO 8601. |
order_id | string Unique transaction and reference number. |
status | string Current transaction status. Possible values: completed, in_progress, failed. |
amount | numeric Transaction full amount, including two decimal places. |
description | string Transaction description. |
error_message | string If the transaction is in failed status, this field will include the error message. |
customer_id | string Unique identifier for the customer who this transaction belongs. If the value is null the transaction belongs to Merchant account. |
currency | string Currency used in the operation by default is MXN (Mexican pesos). |
bank_account | object Bank account data used for the transaction. See the BankAccount object. |
card | object Credit card data used in the transaction. See the Card object. |
card_points | object Contains information about the reward points used for payment, if they were used. See the CardPoints object |
Address Object
Object example:
{
"line1":"Av 5 de Febrero",
"line2":"Roble 207",
"line3":"col carrillo",
"state":"Queretaro",
"city":"Querétaro",
"postal_code":"76900",
"country_code":"MX"
}
Property | Description |
---|---|
line1 | string (required) The first line is the card owner address. It’s commonly used to indicate street address and number. |
line2 | string Second addres line, commonly use to indicate interior number, suite number or county. |
line3 | string Third address line, commonly use to to indicate the neighborhood. |
postal_code | string (required) Zip code |
state | string (required) State |
city | string (required) City |
country_code | string (required) Country code, in the two character format: ISO_3166-1. |
Store object
Object example:
{
"reference":"OPENPAY02DQ35YOY7",
"barcode_url":"https://sandbox-api.openpay.mx/barcode/OPENPAY02DQ35YOY7?width=1&height=45&text=false",
"paybin_reference":"0101990000001065",
"barcode_paybin_url":"https://sandbox-api.openpay.mx/barcode/0101990000001065?width=1&height=45&text=false"
}
Property | Description |
---|---|
reference | string Payment reference to go stores and make deposits to Openpay account |
barcode_url | string It is the url that generates the bar code of reference. |
paybin_reference | string Paybin reference to go store and make deposits to Openpay |
barcode_paybin_url | string It is the url that generates the bar code of paybin reference. |
PaymentPlan Object
Object example:
{
"payments":"6"
}
Property | Description |
---|---|
payments | numeric Plan data months without interest is desired as use in the charge (3, 6, 9, 12, 18). |
Cardpoints Object
Object example:
{
"used": 134,
"remaining": 300,
"caption": "TRANSACCION APROBADA. ME OBLIGO EN LOS TERMINOS Y CONDICIONES DEL PROGRAMA RECOMPENSAS SANTANDER. PARA CUALQUIER DUDA O ACLARACION LLAME AL 01800 RECOMPE (73-266-73).",
"amount": 10
}
Property | Description |
---|---|
used | numeric Amount of points used in the payment. |
remaining | numeric Amount of points remaining in the card after the payment. |
amount | numeric Transaction amount paid using points. |
caption | string (optional) A message to be shown to the customer in their ticket or receipt. |
Object Geolocation
Object example:
{
"lng": -100.421865,
"lat": 20.618171,
"place_id": "ChIJwSN2wpNa04URsDryLW517lg"
}
Property | Description |
---|---|
lng | numeric Longitud, geographical coordinate. |
lat | numeric Latitud, geographical coordinate. |
place_id | string Unique identifier of google maps |
Object PaynetChain
Object example:
{
"name": "EXTRA",
"logo": "http://www.openpay.mx/logotipos/extra.png",
"thumb": "http://www.openpay.mx/thumb/extra.png",
"max_amount": 99999.99
}
Property | Description |
---|---|
name | string Chain name. |
logo | string URL logo image chain. |
thumb | string URL thumbnail image chain. |
max_amount | numeric Maximum payment amount that accept chain stores |
Object Transaction Status
Value | Description |
---|---|
IN_PROGRESS | Transaction is in progress |
COMPLETED | Transaction was succesfully completed |
REFUNDED | Transaction that has been refunded |
CHARGEBACK_PENDING | Transaction that has a pending chargeback |
CHARGEBACK_ACCEPTED | Transaction that has an accepted chargeback |
CHARGEBACK_ADJUSTMENT | Transaction that has an ajust for chargeback |
CHARGE_PENDING | Transaction that is waiting to be paid |
CANCELLED | Transaction that was not paid and has been cancelled |
FAILED | Transaction that was paid but ocurred an error |
Electronic Invoice
Generation of CFDI Object
Field | Description |
---|---|
openpay_transaction_id | Optional Id of the transaction in openpay |
invoice_id | Required Invoice identifier / trade purchase order |
tipo_comprobante | Optional (default (I) income) Voucher Type Object. |
serie | Optional (1-25 Alphanumeric) series invoice in case of handling |
folio | Optional payment (1-40 Alphanumeric) Folio of the invoice in case of handling |
total | Required (Decimal) Total invoice |
subtotal | Required (Decimal) Subtotal of the invoice |
forma_pago | Required Way to pay Only the payment code corresponding to the payment method must be sent. Form of Payment Object. |
metodo_pago | Required Payment method Payment Method Object. |
lugar_expedicion | Required (5 digits) Postal Code of the Place of Expedition |
descuento | Optional (Decimal) Discount amount. |
observaciones | Opcional (Alfanumérico) Observations |
total_trasladados | Optional (Decimal) Total taxes transferred if they exist |
total_retenidos | Optional (Decimal) Total taxes withheld if there are |
moneda | Required (3 Alphanumeric) Currency in which the sale was made in case it is different from MXN. (ISO 4217) |
tipo_de_cambio | Required (Decimal) Exchange rate of the currency in which the sale was made. 1.00 in case the currency is MXN. |
receptor | Required (Receiver Object) Node that contains the data of the recipient of the invoice |
conceptos | Required (Arrangement of Concept Object) Arrangement of concepts included in the invoice |
cfdi_relacionados | Optional (Objeto Relacionados) Related invoices |
complements | Optional (Complements Object) Complements |
Voucher Type Object
Tax receipt type | Fiscal Document |
---|---|
(I) entry |
|
(E) egress |
|
(T) transfer |
|
(N) paysheet |
|
(P) Payment |
|
Form of Payment Object
Key | Description |
---|---|
01 | Cash. |
02 | Cheque nominative. |
03 | Electronic funds transfer. |
04 | Credit card. |
05 | Electronic Wallet. |
06 | Electronic Money. |
08 | Pantry vouchers. |
12 | Dation in payment. |
13 | Payment by subrogation. |
14 | Payment by consignment. |
15 | Condonation. |
17 | Compensation. |
23 | Novation. |
24 | Confusion. |
25 | Debt remittance. |
26 | Prescription or expiration. |
27 | To the satisfaction of the creditor. |
28 | Debit Card. |
29 | Service Card. |
30 | Application of advances. |
99 | Others. |
Payment Method Object
Key | Description |
---|---|
PUE | Payment only exhibition |
PPD | Partial or deferred payments |
DoctoRelacionado Object
Key | Description |
---|---|
id_documento | Required (16-36 Alphanumeric) Document identifier (uuid). |
serie | Optional (1-25 Alphanumeric) Document series. |
folio | Optional (1-40 Alphanumeric) Folio of the document. |
moneda_d_r | Required (3 Alphabetical) Currency Code (ISO 4217). |
tipo_cambio_d_r | Optional (Decimal) Exchange rate. |
metodo_de_pago_d_r | Optional Payment method. |
num_parcialidad | Optional Partiality number. |
imp_saldo_ant | Optional (Decimal) Amount of the previous balance. |
imp_pagado | Optional (Decimal) Amount paid. |
imp_saldo_insoluto | Optional (Decimal) Amount of the outstanding balance. |
Concept Object
Key | Description |
---|---|
Identificador | Required (1-100 Alphanumeric) Concept identifier. |
cantidad | Required (Decimal) Amount of the concept. |
unidad | Optional (1-20 Alphanumeric) Unit of the concept. |
clave_unidad | Required (Alphanumeric, Key Unit Catalog) Unit key. |
descripcion | Required (1-1000 Alphanumeric) Description of the concept. |
valor_unitario | Required (Decimal) Unit value of the concept. |
importe | Required (Decimal) Amount of the transferred tax. |
clave | Required (1-10 Numérico) Key of the product. |
descuento | Optional (Decimal) Discount amount. |
traslados | Optional (Arrangement Tax Object) Transfer tax list. |
retenciones | Optional (Arrangement Tax Object) Retention tax list. |
Tax Object
Key | Description |
---|---|
impuesto | Required Tax Tax Type Object. |
tipo_factor | Required Type of factor Codes:
|
tasa | Required Decimal Rate that will be used to calculate the tax |
importe | Required Tax amount calculated |
base | Optional Amount on which the Tax will be applied |
Tax Type Object
Code | Description |
---|---|
001 | ISR |
002 | IVA |
003 | IEPS |
Receiver Object
Field | Description |
---|---|
nombre | Required (1-254 Alphanumeric) Name of the recipient of the invoice. |
rfc | Required RFC of the invoice recipient. |
Optional Invoice recipient’s email. |
|
residencia_fiscal | Optional Postal code of the fiscal residence. |
uso_cfdi | Required (3 Alphanumeric) Object Use of CFDI. |
pais | Optional (3 Alphanumeric) Country code (ISO 3166-1 alpha-3). It should not be sent if the RFC is registered with the SAT or is a national generic RFC. |
Object Use of CFDI
Code | Description |
---|---|
G01 | Acquisition of merchandise. |
G02 | Returns, discounts or bonuses. |
G03 | Expenses in general. |
I01 | Buildings. |
I02 | Office furniture and equipment for investments. |
I03 | Transportation equipment. |
I04 | Computer equipment and accessories. |
I05 | Dices, dies, molds, matrices and tooling. |
I06 | Telephone communications. |
I07 | Satellite communications. |
I08 | Other machinery and equipment. |
D01 | Medical and dental fees and hospital expenses. |
D02 | Medical expenses due to disability or disability. |
D03 | Funeral expenses. |
D04 | Donations. |
D05 | Real interest actually paid for mortgage credits (house room). |
D06 | Voluntary contributions to SAR. |
D07 | Premiums for medical expenses insurance. |
D08 | Mandatory school transportation expenses. |
D09 | Deposits in accounts for savings, premiums based on pension plans. |
D10 | Payments for educational services (tuition fees). |
P01 | To define. |
Related Object
Field | Description |
---|---|
tipo_relacion | Required Type relationship Object Type of Relationship. |
relacionados | Required (Object arrangement CfdiRelacionado) CFDI Object Related. |
Object Type of Relationship
Code | Description |
---|---|
01 | Credit note of related documents. |
02 | Debit note of related documents. |
03 | Return of merchandise on previous invoices or transfers. |
04 | Replacement of previous CFDIs. |
05 | Goods transfers previously invoiced. |
06 | Invoice generated by previous transfers. |
07 | CFDI by advance payment. |
CFDI Object Related
Field | Description |
---|---|
uuid | Required (36 Alphanumeric) UUID of the related invoice |
Complements Object
Field | Description |
---|---|
aerolineas | Optional (Complement Airlines Object) Complement for Airline. |
payouts | Optional (Complement Payment Object) Complement of payments. |
donatarias | Optional (Complement Donee Object) Complement of donee. |
Complement Airlines Object
Field | Description |
---|---|
tua | Required (Decimal) Airport use fee |
otrosCargos | Optional (Arrangement Charge Airlines Object) Complement of payments. |
Charge Airlines Object
Field | Description |
---|---|
codigo_cargo | Optional Charge code. |
descripcion_cargo | Optional Charge description. |
importe | Optional (Decimal) Charge amount. |
Complement Payment Object
Field | Description |
---|---|
fecha_pago | Required Date of the operation. |
forma_de_pago | Required Way to pay. |
moneda_p | Required (Decimal) Charge amount. |
tipo_cambio_p | Required (Decimal) Exchange rate of the currency in which the sale was made. 1.00 in case the currency is MXN. |
monto | Required (Decimal) Payment amount. |
num_operacion | Optional (1-100 Alphanumeric) Payment number. |
rfc_emisor_cta_ord | Optional RFC of the issuer. |
nom_banco_ord_ext | Optional (1-300 Alphanumeric) Name of the bank. |
cta_ordenante | Optional (10-50 Alphanumeric) Ordering account. |
rfc_emisor_cta_ben | Beneficiary |
cta_beneficiario | Optional (10-50 Alphanumeric) Beneficiary account. |
tipo_cad_pago | Optional (único valor válido 01) Type of payment chain. |
cert_pago | Optional (byte[]) Payment certificate. |
sello_pago | Optional (byte[]) Payment stamp. |
cad_pago | Optional (1-8192 Alphanumeric) Chain. |
docto_relacionados | Optional (Arrangement DoctoRelacionado Object). |
Complement Donee Object
Field | Description |
---|---|
no_autorizacion | Required Authorization number |
fecha_autorizacion | Required Authorization date (YYYY-MM-DD) |
leyenda | Required Caption |
Request Response Generation Object
Field | Description |
---|---|
invoice_id | Identifier of the invoice sent in the request. |
request_id | Request ID generated by Openpay. |
date | Date on which the generation was requested |
status | PENDING, OK, ERROR. |
fiscal_status | ACTIVE, CANCELLED. |
message | Status description. |
Notifications Object
Field | Description |
---|---|
invoice_id | Identifier of the invoice sent in the request. |
serie | Invoice series. |
folio | Folio of the invoice. |
transaction_id | Openpay transaction identifier linked to the invoice. |
creation_date | Application date. |
issue_date | Issue date of the invoice. |
uuid | UUID of the invoice. |
receiver_rfc | RFC of the invoice recipient. |
total | Total invoice |
subtotal | Subtotal of the invoice |
status | PENDING, OK, ERROR. |
fiscal_status | ACTIVE, CANCELLED. |
cancellation_date | Date of cancellation of the invoice in case it is canceled. |
public_xml_link | Link to download the XML of the invoice. |
public_pdf_link | Link to download the PDF of the invoice. |
link_expiration_date | Expiration of the download leagues, once expired the xml / pdf can be downloaded from the dashboard. |
message | Detail of the status of the invoice. |