Introduction
Documentation for specific gateways can be found here. These gateways are available only to some merchant accounts.
NTT Data BlueGate
The BlueGate implementation allows creating card charges and refunds in JPY and other currencies depending on the Merchant BlueGate account. It allows direct charges, as well as charges using a web payment form.
Direct Charge
Endpoint
POST /v1/{MERCHANT_ID}/charges
Charges with BlueGate are done the same as regular card charges in the Openpay API. BlueGate does not allow authorization-only transactions for now.
Sample request
{
"method": "card",
"source_id": "kyeayujmaizcsjm0ir0p",
"amount": "12000",
"currency": "JPY",
"description": "BlueGate charge test",
"order_id": "uniqueID-123123123",
"customer": {
"name": "Eli",
"last_name": "Lopez",
"phone_number": "1234567890",
"email": "eli.lopez@openpay.mx",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "required",
"country_code": "JP"
}
},
"affiliation": {
"name": "JPY_WEB"
}
}
Sample response
{
"id": "trpqmw2oxgffdzmdivcv",
"authorization": "1000001",
"operation_type": "in",
"method": "card",
"transaction_type": "charge",
"card": {
"type": "unknown",
"brand": "visa",
"address": {
"line1": "line line line",
"line2": null,
"line3": null,
"state": "queretaro",
"city": "queretaro",
"postal_code": "76000",
"country_code": "MX"
},
"card_number": "450000XXXXXX0007",
"holder_name": "Eli Carlos",
"expiration_year": "20",
"expiration_month": "12",
"allows_charges": true,
"allows_payouts": false,
"bank_name": null,
"bank_code": "000"
},
"status": "completed",
"conciliated": true,
"creation_date": "2017-07-12T11:24:33-05:00",
"operation_date": "2017-07-12T20:24:34-05:00",
"description": "BlueGate charge test",
"error_message": null,
"order_id": "uniqueID-123123123",
"amount": 12000,
"customer": {
"name": "Eli",
"last_name": "Lopez",
"email": "eli.lopez@openpay.mx",
"phone_number": "1234567890",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "required",
"country_code": "JP"
},
"creation_date": "2017-07-12T11:24:33-05:00",
"external_id": null,
"clabe": null
},
"currency": "JPY"
}
Testing values
For testing BlueGate, please use the following success card:
Card | Result |
---|---|
4500000000000007 | Success |
For rejected transactions, use the following cards:
Card | Result |
---|---|
4500000000000015 | Card Rejected |
4500000000000023 | Fondos insuficientes |
4500000000000031 | Card Rejected |
4500000000000049 | Operation rejected |
4500000000000056 | Operation rejected |
4500000000000064 | Operation rejected |
4500000000000072 | Operation rejected |
4500000000000080 | Operation rejected |
4500000000000098 | Operation rejected |
Storing a card during a charge for future use
In order to store a card with Bluegate during a charge, the property provider
must be specified.
This property must contain bluegate
as the name of the gateway, and in the data field, contain the
external identifier to use for the card with the name db_key
. The response sent by Openpay does not change.
Sample request
{
"method": "card",
"source_id": "kyeayujmaizcsjm0ir0p",
"amount": "12000",
"currency": "JPY",
"description": "BlueGate charge test",
"order_id": "uniqueID-123123123",
"customer": {
"name": "Eli",
"last_name": "Lopez",
"phone_number": "1234567890",
"email": "eli.lopez@openpay.mx",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "required",
"country_code": "JP"
}
},
"affiliation": {
"name": "JPY_WEB"
},
"provider": {
"name": "bluegate",
"data": {
"db_key": "T073JV9KXX02F"
}
}
}
Sample response
{
"id": "trpqmw2oxgffdzmdivcv",
"authorization": "1000001",
"operation_type": "in",
"method": "card",
"transaction_type": "charge",
"card": {
"type": "unknown",
"brand": "visa",
"address": {
"line1": "line line line",
"line2": null,
"line3": null,
"state": "queretaro",
"city": "queretaro",
"postal_code": "76000",
"country_code": "MX"
},
"card_number": "450000XXXXXX0007",
"holder_name": "Eli Carlos",
"expiration_year": "20",
"expiration_month": "12",
"allows_charges": true,
"allows_payouts": false,
"bank_name": null,
"bank_code": "000"
},
"status": "completed",
"conciliated": true,
"creation_date": "2017-07-12T11:24:33-05:00",
"operation_date": "2017-07-12T20:24:34-05:00",
"description": "BlueGate charge test",
"error_message": null,
"order_id": "uniqueID-123123123",
"amount": 12000,
"customer": {
"name": "Eli",
"last_name": "Lopez",
"email": "eli.lopez@openpay.mx",
"phone_number": "1234567890",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "required",
"country_code": "JP"
},
"creation_date": "2017-07-12T11:24:33-05:00",
"external_id": null,
"clabe": null
},
"currency": "JPY"
}
Provider object
Property | Description |
---|---|
name | string (required for storing cards) Name of the gateway. In this case fixed to bluegate |
data | Provider Data object (required for storing cards) Object containing specific information for BlueGate. |
BlueGate Provider Data object
Property | Description |
---|---|
db_key | string (required for storing cards) Card identifier to be used in BlueGate. This must be unique and not be used already. |
Retrieving a previously stored card
Endpoint
POST /v1/{MERCHANT_ID}/tokens/external
In order to reuse a previosuly stored card, this must first be retrieved from BlueGate. In order to retrieve this card, the identifier for the card stored in BlueGate must be sent, along with enough information to identify the BlueGate account to use. The returned ID can then be used to create a single charge in Openpay using this stored card.
Sample request
{
"external_id": "T073JV9KXX02F",
"currency": "JPY",
"affiliation": {
"gateway": "bluegate",
"name": "JPY_WEB"
}
}
Sample response
{
"id": "ka1zuda8rpvka9qr0zzl",
"card": {
"card_number": "XXXXXXXXXXXX0000",
"holder_name": "Bluegate Member T073JV9KXX02F",
"expiration_year": "20",
"expiration_month": "12",
"address": null,
"creation_date": null,
"brand": "other"
}
}
Retrieve BlueGate Card request
Property | Description |
---|---|
external_id | string (required) Card identifier used in BlueGate (DB Key). Must exist and not have been deleted. |
currency | string (required) Currency in which the charge will be done. |
affiliation | Affiliation object (required) Specific affiliation information |
Affiliation object
Property | Description |
---|---|
gateway | string (required) Gateway from which the card will be retrieved. In this case it must be fixed to bluegate |
name | string (required) Name of the affiliation to use. |
Response object
Property | Description |
---|---|
id | string Token used to charge the card retrieved from BlueGate in Openpay. |
card | Card object Information about the card retrieved from BlueGate. |
Deleting a stored card
Endpoint
DELETE /v1/{MERCHANT_ID}/tokens/external/{tokenId}
In order to delete a previosuly stored card, it must first be retrieved from BlueGate. After retrieving the card, the Token ID returned can then be used to delete the card information from BlueGate.
Refunds
Endpoint
POST /v1/{MERCHANT_ID}/charges/{TRANSACTION_ID}/refund
Refunds are done the same as regular card refunds in the Openpay API. BlueGate allows partial refunds only when using JPY, which can be made sending the amount to refund in the request. Otherwise, it is not required to send a body.
Sample request for partial refund
{
"amount": "500"
}
Sample response
{
"id": "trpqmw2oxgffdzmdivcv",
"authorization": "1000001",
"operation_type": "in",
"method": "card",
"transaction_type": "charge",
"card": {
"type": "unknown",
"brand": "visa",
"address": {
"line1": "line line line",
"line2": null,
"line3": null,
"state": "queretaro",
"city": "queretaro",
"postal_code": "76000",
"country_code": "MX"
},
"card_number": "450000XXXXXX0007",
"holder_name": "Eli Carlos",
"expiration_year": "20",
"expiration_month": "12",
"allows_charges": true,
"allows_payouts": false,
"bank_name": null,
"bank_code": "000"
},
"status": "completed",
"refund": {
"id": "trfts7eo1ytpraxmnlpf",
"authorization": "1000002",
"operation_type": "out",
"method": "card",
"transaction_type": "refund",
"status": "completed",
"conciliated": true,
"creation_date": "2017-07-12T20:51:11-05:00",
"operation_date": "2017-07-12T20:51:11-05:00",
"description": null,
"error_message": null,
"order_id": null,
"amount": 1000,
"customer": {
"name": "Eli",
"last_name": "Lopez",
"email": "eli.lopez@openpay.mx",
"phone_number": "1234567890",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "required",
"country_code": "JP"
},
"creation_date": "2017-07-12T11:24:34-05:00",
"external_id": null,
"clabe": null
},
"currency": "JPY"
},
"conciliated": true,
"creation_date": "2017-07-12T11:24:33-05:00",
"operation_date": "2017-07-12T20:24:34-05:00",
"description": "BlueGate charge test",
"error_message": null,
"order_id": "uniqueID-123123123",
"amount": 12000,
"customer": {
"name": "Eli",
"last_name": "Lopez",
"email": "eli.lopez@openpay.mx",
"phone_number": "1234567890",
"address": null,
"creation_date": "2017-07-12T11:24:34-05:00",
"external_id": null,
"clabe": null
},
"currency": "JPY"
}
Web form payment
Another option is to request that the customer enters their card information in an Openpay webpage.
To create a form payment, you need to specify confirm = false, and omit any card information from the request.
Example request
{
"method": "card",
"amount": "1000",
"currency": "JPY",
"description": "Test for direct charge",
"order_id": "uniqueId-0019913",
"confirm": false,
"customer": {
"name": "Eli",
"last_name": "Lopez",
"phone_number": "1234567890",
"email": "eli.lopez@openpay.mx",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "required",
"country_code": "JP"
}
},
"affiliation": {
"name": "JPY_WEB"
}
}
Example response
{
"id": "trfvgz8jgeutsteyhk9l",
"authorization": null,
"operation_type": "in",
"method": "card",
"transaction_type": "charge",
"status": "charge_pending",
"conciliated": false,
"creation_date": "2017-07-12T12:04:46-05:00",
"operation_date": "2017-07-12T12:04:46-05:00",
"description": "Test for direct charge",
"error_message": null,
"order_id": "uniqueId-0019913",
"amount": 1000,
"customer": {
"name": "Eli",
"last_name": "Lopez",
"email": "eli.lopez@openpay.mx",
"phone_number": "1234567890",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "required",
"country_code": "JP"
},
"creation_date": "2017-07-12T12:04:46-05:00",
"external_id": null,
"clabe": null
},
"payment_method": {
"type": "redirect",
"url": "https://sandbox-api.openpay.mx/v1/mpnbqgfnd5bekfzfq3gd/charges/trfvgz8jgeutsteyhk9l/card_capture"
},
"currency": "JPY"
}
3D Secure
The process for 3D Secure requires the user to be redirect to their card issuer in order for them to authenticate themselves. For this, some changes need to be done to the calls sent to the Openpay API.
The complete steps for the 3D Secure integration are as follows:
Card tokenization
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":"Queretaro",
"postal_code":"76900",
"country_code":"MX"
},
"creation_date":null,
"brand":"visa"
}
}
The card tokenization does not change compared to a regular card charge.
A token must be created directly from the website after the user enters their card information, using JavaScript to send this information to Openpay. This prevents the card data from being transmitted to your back-end servers.
In order to create a token, you can use the JavaScript library provided by Openpay (Openpay.js), or you can implement your own JavaScript using the API definition found at the general API documentation.
Charge with 3D Secure
Example request
{
"source_id": "k2izlc1bzfihf43rxcv6",
"method": "card",
"amount": 3505,
"currency": "JPY",
"description": "Credit Card Charge",
"order_id": "2RARVJ-1518431",
"customer": {
"name": "ATSUMI",
"last_name": "MURAKAMI",
"phone_number": "11111111",
"email": "example@example.com",
"address": {
"line1": "HAGINAKA",
"line2": "",
"line3": "",
"state": "OTAKU",
"city": "TOKYO",
"postal_code": "1440047",
"country_code": "JP"
}
},
"affiliation": {
"name": "JPY_WEB"
},
"redirect_url": "http://www.example.com/bookingResult",
"use_3d_secure": "true"
}
Example response
{
"id": "trfvgz8jgeutsteyhk9l",
"authorization": null,
"operation_type": "in",
"method": "card",
"transaction_type": "charge",
"status": "charge_pending",
"conciliated": false,
"creation_date": "2017-07-12T12:04:46-05:00",
"operation_date": "2017-07-12T12:04:46-05:00",
"description": "Credit Card Charge",
"error_message": null,
"order_id": "uniqueId-0019913",
"amount": 3505,
"customer": {
"name": "ATSUMI",
"last_name": "MURAKAMI",
"phone_number": "11111111",
"email": "example@example.com",
"address": {
"line1": "HAGINAKA",
"line2": "",
"line3": "",
"state": "OTAKU",
"city": "TOKYO",
"postal_code": "1440047",
"country_code": "JP"
},
"creation_date": "2017-07-12T12:04:46-05:00",
"external_id": null,
"clabe": null
},
"payment_method": {
"type": "redirect",
"url": "https://sandbox-api.openpay.mx/v1/mpnbqgfnd5bekfzfq3gd/charges/trfvgz8jgeutsteyhk9l/redirect"
},
"currency": "JPY"
}
In order to use 3D Secure with Bluegate, two additional parameters must be sent in the request:
Property | Description |
---|---|
use_3d_secure | boolean (required) Value indicating that the charge must be 3D Secure. Send as true |
redirect_url | string (required) URL to where the user should be redirected to after 3D Secure process is finished |
The rest of the request can be the same as the ones used during a direct charge.
During the response, pay attention to the following fields:
Property | Description |
---|---|
status | string The status of the transaction. It can be either completed , failed , or charge_pending . In the case of either completed or failed , the response should be processed the same as when using a direct charge. |
payment_method | Object This field will be returned if the transaction is in status charge_pending . It contains information about how to complete the payment. |
payment_method.type | string Fixed to redirect in this case. |
payment_method.url | string Contains the URL to which the user should be redirected to. |
Redirecting the User
Example URL to which the customer will be returned:
https://wwww.example.com/bookingResult?id=trfvgz8jgeutsteyhk9l
After receiving the response, if the transaction was received with a status of charge_pending
, the merchant must
retrieve the URL contained in the field payment_method
.url
, and redirect the customer to this URL. From then on,
Openpay will handle the process to call the Bluegate API for 3D Secure and authorization.
Retrieving the transaction status
Request example
curl https://sandbox-api.openpay.mx/v1/mpnbqgfnd5bekfzfq3gd/charges/trfvgz8jgeutsteyhk9l \
-u sk_12341234123412341234123412341234:
Response example
{
"id": "trfvgz8jgeutsteyhk9l",
"authorization": null,
"operation_type": "in",
"method": "card",
"transaction_type": "charge",
"status": "completed",
"authorization" : "801585",
"conciliated": false,
"creation_date": "2017-07-12T12:04:46-05:00",
"operation_date": "2017-07-12T12:04:46-05:00",
"description": "Credit Card Charge",
"error_message": null,
"order_id": "uniqueId-0019913",
"amount": 3505,
"customer": {
"name": "ATSUMI",
"last_name": "MURAKAMI",
"phone_number": "11111111",
"email": "example@example.com",
"address": {
"line1": "HAGINAKA",
"line2": "",
"line3": "",
"state": "OTAKU",
"city": "TOKYO",
"postal_code": "1440047",
"country_code": "JP"
},
"creation_date": "2017-07-12T12:04:46-05:00",
"external_id": null,
"clabe": null
},
"payment_method": {
"type": "redirect",
"url": "https://sandbox-api.openpay.mx/v1/mpnbqgfnd5bekfzfq3gd/charges/trfvgz8jgeutsteyhk9l/redirect"
},
"currency": "JPY"
}
After the user finishes the 3D Secure process, if successful, Openpay will send the authorization request to Bluegate.
Once the result is received and the transaction updated accordingly, the user will be redirected to the URL received
in the field redirect_url
sent in the original charge request. The parameter id
will be added to this URL, containing
the value of the transaction ID.
The merchant must then use this ID to retrieve the current transaction status from Openpay. For this the API to get a charge can be used. The response to this API will be the transaction object as is usually returned during a direct charge.
The possible status returned are as follows:
Status | Description |
---|---|
completed | The transaction was completed successfuly. |
failed | The transaction was rejected by Bluegate, or the 3D Secure authentication process failed. |
Any other status must be considered an error, and should be reported to Openpay.
This information can then be used to finalize the order in the merchant’s website and show the customer the corresponding message depending on the status.
Receiving the webhook
After a payment is completed during 3D Secure, a charge.succeeded
notification will be sent by Openpay to all the registered webhooks.
It is recommended to listen to this webhook and complete the order as an alternative to the redirect, in order to handle cases where
the user may have closed their window after the 3D Secure process, or when for some reason the user is not able to be redirected
back to the Merchant’s website.
A webhook example is shown in the next section.
Confirmation Webhook
Once that a payment is completed, either through the webpage or in a direct charge, Openpay sends a notification to the Merchant’s configured webhook.
Sample webhook
{
"type": "charge.succeeded",
"event_date": "2017-07-12T12:13:46-05:00",
"transaction": {
"id": "trfvgz8jgeutsteyhk9l",
"authorization": "1000001",
"operation_type": "in",
"method": "card",
"transaction_type": "charge",
"card": {
"type": "unknown",
"brand": "visa",
"address": null,
"card_number": "450000XXXXXX0007",
"holder_name": "ELI",
"expiration_year": "22",
"expiration_month": "04",
"allows_charges": true,
"allows_payouts": false,
"bank_name": null,
"bank_code": "000"
},
"status": "completed",
"conciliated": true,
"creation_date": "2017-07-12T12:04:46-05:00",
"operation_date": "2017-07-12T21:13:44-05:00",
"description": "Test for direct charge",
"error_message": null,
"order_id": "uniqueId-0019913",
"amount": 1000,
"customer": {
"name": "Eli",
"last_name": "Lopez",
"email": "eli.lopez@openpay.mx",
"phone_number": "1234567890",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "required",
"country_code": "JP"
},
"creation_date": "2017-07-12T12:04:47-05:00",
"external_id": null,
"clabe": null
},
"currency": "JPY"
}
}
Wellnet
The wellnet implementation allows payments through Wellnet-enabled businesses and terminals. The payment is registered in Wellnet, and then paid by the customer at those sites. Wellnet then notifies Openpay of the payment, and Openpay in turn notifies the merchant using a webhook.
Payment through redirect
Endpoint
POST /v1/{MERCHANT_ID}/charges
When a transaction with Wellnet is created an URL is returned in the response. This URL will redirect the customer to a Wellnet website with instructions on how to make their payment.
Sample request
{
"method": "store",
"amount": "120000",
"currency": "JPY",
"description": "Wellnet charge",
"due_date": "2017-07-13T10:00:00Z",
"order_id": "uniqueId-14937539",
"customer": {
"name": "Eli",
"last_name": "Lopez",
"phone_number": "1234567890",
"email": "eli.lopez@openpay.mx",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "required",
"country_code": "JP"
}
},
"affiliation": {
"name": "JPY_WEB"
},
"provider": {
"name": "wellnet"
}
}
Sample response
{
"id": "trcjgacyabpo7n6cv0ti",
"authorization": null,
"operation_type": "in",
"method": "store",
"transaction_type": "charge",
"status": "charge_pending",
"conciliated": false,
"creation_date": "2017-07-12T12:23:41-05:00",
"operation_date": "2017-07-12T12:23:41-05:00",
"description": "Wellnet charge",
"error_message": null,
"order_id": "uniqueId-14937539",
"due_date": "2017-07-13T05:00:00-05:00",
"amount": 120000,
"customer": {
"name": "Eli",
"last_name": "Lopez",
"email": "eli.lopez@openpay.mx",
"phone_number": "1234567890",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "required",
"country_code": "JP"
},
"creation_date": "2017-07-12T12:23:41-05:00",
"external_id": null,
"clabe": null
},
"payment_method": {
"type": "redirect",
"url": "https://dev-api.openpay.mx/v1/mpnbqgfnd5bekfzfq3gd/charges/trcjgacyabpo7n6cv0ti/redirect/"
},
"currency": "JPY"
}
Payment request email
Optionally, the merchant may request that an email is sent to the customer. This allows to give this information to the customer in cases where the customer is not using a browser, such as in a Call Center. In this case, it is recommended that you provide the timezone of the customer and the language in order to send the information correctly in the email. Otherwise the default timezone and language for the merchant will be used.
Sample request
{
"method": "store",
"amount": "120000",
"currency": "JPY",
"description": "Wellnet charge",
"due_date": "2017-07-14T10:00:00Z",
"order_id": "uniqueId-14303933",
"send_email": true,
"customer": {
"name": "Eli",
"last_name": "Lopez",
"phone_number": "1234567890",
"email": "eli.lopez@openpay.mx",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "required",
"country_code": "JP"
}
},
"affiliation": {
"name": "JPY_WEB"
},
"provider": {
"name": "wellnet"
},
"i18n": {
"locale": "ja-JP",
"timezone": "Tokyo"
}
}
Testing website
In order to simulate a payment during testing, Wellnet provides a testing Website. The merchant has to use their credentials to enter this website, then enter the payment number, and click the button to simulate payment.
https://waps.kessai.info/WebJigyosyaTest/Login.aspx
Confirmation Webhook
Once the customer pays their transaction, Openpay sends a notification to the Merchant’s configured webhooks.
NTT Data Hong Kong
The NTT Data Hong Kong implementation allows payments through a hosted page that includes different payment methods to complete the charge. The payment is registered in NTT Data Hong Kong, and then paid by the customer with his prefered payment method. NTT Data Hong Kong then notifies Openpay with the payment status. Afterwards Openpay notifies this status to the merchant using a webhook.
Payment through redirect
Endpoint
POST /v1/{MERCHANT_ID}/charges
When a transaction with NTT Data Hong Kong is created, a URL is returned in the response. This URL will redirect the customer to an NTT Data Hong Kong website with the instructions of how to make their payment.
Sample request
{
"method": "card",
"amount": 10000,
"description": "NTT Data HK Charge",
"order_id": "uniqueId-457893",
"currency": "JPY",
"due_date": "2019-10-08T06:45:00+08:00",
"customer": {
"name": "Jesus",
"last_name": "Gutierrez",
"email": "jesus.gutierrez@openpay.mx",
"phone_number": "86-1372474530",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"city": "Required",
"state": "Required",
"postal_code": "Required",
"country_code": "JP"
}
},
"affiliation" : {
"name" : "WEB_HOSTED"
},
"gateway": {
"data":{
"ntt_data_hong_kong" : {
"selectedMethod" : "unionpay.merchanthosted",
"transactionType":"01",
"documentType":"01"
}
}
},
"provider": {
"name": "ntt_data_hong_kong"
},
"i18n": {
"locale": "en-us",
"timezone": "Asia/Hong_Kong"
},
"confirm": false,
"redirect_url": "http://www.openpay.mx/index.html"
}
Sample response
{
"id": "tran2ksabpkwy06dl1xf",
"authorization": null,
"operation_type": "in",
"method": "card",
"transaction_type": "charge",
"status": "charge_pending",
"conciliated": false,
"creation_date": "2019-10-09T13:47:17-05:00",
"operation_date": "2019-10-09T13:47:17-05:00",
"description": "NTT Data HK Charge",
"error_message": null,
"order_id": "uniqueId-457893",
"due_date": "2019-10-09T13:57:00-05:00",
"payment_method": {
"type": "redirect",
"url": "https://sandbox-api.openpay.mx/v1/m8qhaxphca5ojeisvkkf/charges/tran2ksabpkwy06dl1xf/redirect/"
},
"currency": "JPY",
"amount": 10000,
"customer": {
"name": "Jesus",
"last_name": "Gutierrez",
"email": "jesus.gutierrez@openpay.mx",
"phone_number": "86-1372474530",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"city": "Required",
"state": "Required",
"postal_code": "Required",
"country_code": "JP"
},
"creation_date": "2019-10-09T13:47:17-05:00",
"external_id": null,
"clabe": null
}
}
Testing values
For testing NTT Data Hong Kong, please use the following values:
For UnionPayInternacional, use the following cards:
Card | Expiry | CVV |
---|---|---|
6250947000000014 | 12/33 | 123 |
8171999927660000 | 12/30 | 123 |
For Alipay, use the following credentials:
Buyer account | Login pass | Payment pass |
---|---|---|
cnbuyer_0531@alitest.com | 111111 | 111111 |
Refunds
Endpoint
POST /v1/{MERCHANT_ID}/charges/{TRANSACTION_ID}/refund
Refunds are done the same as regular card refunds in the Openpay API. NTT Data Hong Kong allows partial refunds, which can be made sending the amount to refund in the request. Otherwise, it is not required to send a body.
Sample request
{
"description": "Optional",
"amount": 10000
}
Sample response
{
"id": "tran2ksabpkwy06dl1xf",
"authorization": "957885611",
"operation_type": "in",
"method": "card",
"transaction_type": "charge",
"status": "completed",
"conciliated": false,
"creation_date": "2019-10-09T14:56:02-05:00",
"operation_date": "2019-10-09T14:56:40-05:00",
"description": "NTT Data HK Charge",
"error_message": null,
"order_id": "uniqueId-457893",
"due_date": "2019-10-09T13:57:00-05:00",
"refunds": [
{
"operation_date": "2019-10-09T14:57:34-05:00",
"authorization": "957885611",
"amount": 10000,
"status": "completed",
"conciliated": false,
"id": "triyydyxjh0duhimaeds",
"description": "Refund trqtarfwmwl4jw5m6mz8",
"fee": {
"amount": 5.0000,
"tax": 0.8000,
"currency": "MXN"
},
"currency": "JPY"
}
],
"refund": {
"operation_date": "2019-10-09T14:57:34-05:00",
"authorization": "957885611",
"amount": 10000,
"operation_type": "out",
"method": "card",
"transaction_type": "refund",
"status": "completed",
"conciliated": false,
"id": "triyydyxjh0duhimaeds",
"creation_date": "2019-10-09T14:57:34-05:00",
"description": "Refund trqtarfwmwl4jw5m6mz8",
"customer": {
"name": "Jesus",
"last_name": "Gutierrez",
"email": "jesus.gutierrez@openpay.mx",
"phone_number": "86-1372474530",
"address": null,
"creation_date": "2019-10-09T14:56:01-05:00",
"external_id": null,
"clabe": null
},
"fee": {
"amount": 5.0000,
"tax": 0.8000,
"currency": "MXN"
},
"currency": "JPY"
},
"amount": 10000,
"customer": {
"name": "Jesus",
"last_name": "Gutierrez",
"email": "jesus.gutierrez@openpay.mx",
"phone_number": "86-1372474530",
"address": null,
"creation_date": "2019-10-09T14:56:01-05:00",
"external_id": null,
"clabe": null
},
"fee": {
"amount": 2.5000,
"tax": 0.4000,
"currency": "MXN"
},
"payment_method": {
"type": "redirect",
"url": "https://sandbox-api.openpay.mx/v1/m8qhaxphca5ojeisvkkf/charges/trqtarfwmwl4jw5m6mz8/redirect/"
},
"currency": "JPY"
}
Confirmation Webhook
Once the customer pays their transaction, Openpay sends a notification to the Merchant’s configured webhooks. The merchant must then retrieve the current Transaction status from Openpay to verify the webhook’s authenticity.
WorldPay
The Worldpay implementation allows payments through a hosted page that allows capture the customer’s card. The payment is registered in Worldpay and then notifies Openpay with the payment status. Afterwards Openpay notifies this status to the merchant using a webhook.
Payment through redirect
Endpoint
POST /v1/{MERCHANT_ID}/charges
When a transaction with Worldpay is created, a URL is returned in the response. This URL will redirect the customer to a Worldpay website for capture the card information to complete the payment.
Sample request
{
"method": "card",
"amount": 10000,
"description": "Worldpay Charge",
"order_id": "uniqueId-900002",
"currency": "JPY",
"customer": {
"name": "ATSUMI",
"last_name": "MURAKAMI",
"email": "a.murakami@flypeach.com",
"phone_number": "123456789",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"city": "Required",
"state": "Required",
"postal_code": "Required",
"country_code": "JP"
}
},
"affiliation": {
"name": "WEB_HOSTED"
},
"provider": {
"name": "world_pay"
},
"confirm": false,
"redirect_url": "http://www.openpay.mx/index.html"
}
Sample response
{
"id": "trgaa3op2qpuarrf8cn8",
"authorization": null,
"operation_type": "in",
"method": "card",
"transaction_type": "charge",
"status": "charge_pending",
"conciliated": false,
"creation_date": "2020-01-14T20:35:48-06:00",
"operation_date": "2020-01-14T20:35:48-06:00",
"description": "Worldpay Charge",
"error_message": null,
"order_id": "uniqueId-900002",
"currency": "JPY",
"amount": 10000,
"customer": {
"name": "ATSUMI",
"last_name": "MURAKAMI",
"email": "a.murakami@flypeach.com",
"phone_number": "123456789",
"address": {
"line1": "Line 1 Required",
"line2": "Optional",
"line3": "Optional",
"state": "Required",
"city": "Required",
"postal_code": "Required",
"country_code": "JP"
},
"creation_date": "2020-01-14T20:35:48-06:00",
"external_id": null,
"clabe": null
},
"payment_method": {
"type": "redirect",
"url": "https://sandbox-api.openpay.mx/v1/m8qhaxphca5ojeisvkkf/charges/trgaa3op2qpuarrf8cn8/redirect/"
},
"gateway": {
"affiliation": "APJAIRTEST"
}
}
Testing values
For testing Worldpay integration, please use the following values:
Card | Holdername |
---|---|
343434343434343 | AUTHORISED |
Refunds
Endpoint
POST /v1/{MERCHANT_ID}/charges/{TRANSACTION_ID}/refund
Refunds are done the same as regular card refunds in the Openpay API. Worldpay not allows partial refunds. So that, it is not required to send a body.
Sample request
{
"description": "Optional",
"amount": 10000
}
Sample response
{
"id": "trgaa3op2qpuarrf8cn8",
"authorization": "800427",
"operation_type": "in",
"method": "card",
"transaction_type": "charge",
"status": "completed",
"conciliated": true,
"creation_date": "2020-01-14T20:35:49-06:00",
"operation_date": "2020-01-14T20:37:38-06:00",
"description": "Worldpay Charge",
"error_message": null,
"order_id": "uniqueId-900002",
"refunds": [
{
"operation_date": "2020-01-15T10:19:56-06:00",
"authorization": "000000",
"amount": 10000,
"status": "completed",
"conciliated": true,
"id": "tr6k3j1bqfe2axfw72a1",
"fee": {
"amount": 5.0000,
"tax": 0.8000,
"currency": "MXN"
},
"currency": "JPY"
}
],
"refund": {
"operation_date": "2020-01-15T10:19:56-06:00",
"authorization": "000000",
"amount": 10000,
"operation_type": "out",
"method": "card",
"transaction_type": "refund",
"status": "completed",
"conciliated": true,
"id": "tr6k3j1bqfe2axfw72a1",
"creation_date": "2020-01-15T10:19:56-06:00",
"customer": {
"name": "ATSUMI",
"last_name": "MURAKAMI",
"email": "a.murakami@flypeach.com",
"phone_number": "123456789",
"address": null,
"creation_date": "2020-01-14T20:35:49-06:00",
"external_id": null,
"clabe": null
},
"fee": {
"amount": 5.0000,
"tax": 0.8000,
"currency": "MXN"
},
"currency": "JPY"
},
"currency": "JPY",
"amount": 10000,
"customer": {
"name": "ATSUMI",
"last_name": "MURAKAMI",
"email": "a.murakami@flypeach.com",
"phone_number": "123456789",
"address": null,
"creation_date": "2020-01-14T20:35:49-06:00",
"external_id": null,
"clabe": null
},
"fee": {
"amount": 2.5000,
"tax": 0.4000,
"currency": "MXN"
},
"payment_method": {
"type": "redirect",
"url": "https://sandbox-api.openpay.mx/v1/m8qhaxphca5ojeisvkkf/charges/trgaa3op2qpuarrf8cn8/redirect/"
},
"gateway": {
"affiliation": "APJAIRTEST"
}
}
Confirmation Webhook
Once the customer pays their transaction, Openpay sends a notification to the Merchant’s configured webhooks. The merchant must then retrieve the current transaction status from Openpay to verify the webhook’s authenticity.