Introduction
Welcome to the Ecommerce API REST API. You can use it mainly to process e-commerce transactions, which can be made with different methods such as checkouts, tokenization, recurrence or payment button.
We have language bindings in Shell, Ruby, Python, and JavaScript. You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
Authentication
curl --location --request POST 'https://ecommerce.pmiamericas.net/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Authorization: Basic Ymx1bW9uX3BheV9lY29tbWVyY2VfYXBpOmJsdW1vbl9wYXlfZWNvbW1lcmNlX2FwaV9wYXNzd29yZA==' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=user@email.com' \
--data-urlencode 'password=5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5'
Make sure to replace the fields
username
andpassword
with your API keys. The password field value must be hashed in SHA256.The above command returns JSON structured like this:
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5...",
"token_type": "bearer",
"refresh_token": "eyJhbGciOiJIUzI1NiIs...",
"expires_in": 10799,
"scope": "read write",
"user_entity": 273,
"country": "mx",
"user_id": 333,
"user_system": 6,
"business_id": 273,
"jti": "58a25c13-f29c-4764-ba81-16876a41ce49"
}
The first step for the integration is obtaining an authentication token. To get your API credentials you can sign-in in our developer portal.
The request data is sent as content multipart/form-data
and the response is received as application/json
.
All next API request expect the authentication key included in the header as shown:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Payments Methods
Checkout
curl --location --request POST 'https://ecommerce.pmiamericas.net/checkout/generate' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6Ikp...' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Homer",
"lastName": "Simpson",
"email": "customer@user.com",
"phone": "5544332211",
"amount": 148.13,
"reference": "9827349283187",
"expiration": "2022-01-01",
"paymentConcept": "Payment concept",
"urlCallback ": "index.html/",
"response ": false,
"unique": true
}'
The above command returns JSON structured like this:
{
"status": true,
"requestId": "49f70e9a-85dd-4ed4-b77e-7666911f5b47",
"date": "2021-01-20",
"time": "17:30:47",
"dataResponse": {
"payOrder": "/checkout/zeUf7g6mxes0loP"
}
}
To complete the checkout link, append the base url to the
payOrder
attribute.
https://ecommerce.pmiamericas.net/checkout/zeUf7g6mxes0loP
This endpoint generate a dynamic checkout link.
HTTP Request
POST https://ecommerce.pmiamericas.net/checkout/generate
JSON Parameters
Parameter | Type | Required | Description |
---|---|---|---|
name | String | false | Customer name |
middleName | String | false | Customer middle name |
lastName | String | false | Customer last name |
String | false | Customer email | |
phone | String | false | Customer phone number |
amount | Decimal | false | Amount |
unique | Boolean | true | Indicates if the link can be used multiple times |
reference | String | false | Payment reference |
paymentConcept | String | true | Payment concept |
expiration | String | false | Expiration date Example: 2022-01-01 |
urlCallback | String | false | Return call back at the end of the transaction. |
Charge
curl --location --request POST 'https://ecommerce.pmiamericas.net/ecommerce/charge' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data-raw '{
"amount": 173.01,
"currency": "484",
"customerInformation": {
"firstName": "Client Name",
"lastName": "Last Name",
"middleName": "",
"email": "user@email.com",
"phone1": "5544332211",
"city": "Mexico",
"address1": "Main St 1234",
"postalCode": "01620",
"state": "Mexico",
"country": "MX",
"ip": "0.0.0.0"
},
"noPresentCardData": {
"cardNumber": "4915661111113980",
"cvv": "138",
"cardholderName": "Client Name",
"expirationYear": "25",
"expirationMonth": "03"
}
}'
The above command returns JSON structured like this:
{
"status": true,
"requestId": "b0018aeb-05e9-4ac0-8110-b1296d4d6e00",
"id": "29902",
"date": "2021-01-27",
"time": "12:27:08",
"dataResponse": {
"authorization": "633581",
"description": "APROBADA",
"binInformation": {
"bin": "491566",
"bank": "BANORTE",
"product": "BANORTE ELECTRON",
"type": "DÉBITO",
"brand": "VISA"
},
"lastFour": "3980"
}
}
This endpoint process transactions with the clear card information.
HTTP Request
POST https://ecommerce.pmiamericas.net/ecommerce/charge
JSON Parameters
Parameter | Type | Required | Description |
---|---|---|---|
amount | Double | true | Payment amount |
currency | String | true | Payment currency |
customerInformation | Object | true | Customer information object |
firstName | String | true | Customer first name |
lastName | String | true | Customer last name |
middleName | String | true | Customer middle name |
String | true | Customer email | |
phone1 | String | true | Customer phone |
city | String | true | Customer city |
address1 | String | true | Customer address line |
postalCode | String | true | Customer postal code |
state | String | true | Customer state |
country | String | true | Customer country |
ip | String | true | Customer origin IP address |
noPresentCardData | Object | true | Card data object |
cardNumber | String | true | Card number |
cvv | String | true | Security code |
cardholderName | String | true | Cardholder name |
expirationYear | String | true | Card expiration year (YY) |
expirationMonth | String | true | Card expiration month (MM) |
Charge Installments
curl --location --request POST 'https://ecommerce.pmiamericas.net/ecommerce/charge' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data-raw '{
"amount": 173.01,
"currency": "484",
"customerInformation": {
"firstName": "Client Name",
"lastName": "Last Name",
"middleName": "",
"email": "user@email.com",
"phone1": "5544332211",
"city": "Mexico",
"address1": "Main St 1234",
"postalCode": "01620",
"state": "Mexico",
"country": "MX",
"ip": "0.0.0.0"
},
"noPresentCardData": {
"cardNumber": "4915661111113980",
"cvv": "138",
"cardholderName": "Client Name",
"expirationYear": "25",
"expirationMonth": "03"
},
"promotion": {
"firstPayment": 0,
"month": 3,
"planType": "no_interest"
}
}'
The above command returns JSON structured like this:
{
"status": true,
"requestId": "f149631b-9334-464c-a5c5-97f96e43d98b",
"id": "29905",
"date": "2021-01-27",
"time": "13:14:14",
"dataResponse": {
"authorization": "825256",
"description": "APROBADA",
"binInformation": {
"bin": "491566",
"bank": "BANORTE",
"product": "BANORTE ELECTRON",
"type": "DÉBITO",
"brand": "VISA"
},
"lastFour": "3980"
}
}
This endpoint process transactions with the clear card information with installments.
HTTP Request
POST https://ecommerce.pmiamericas.net/ecommerce/charge
JSON Parameters
Parameter | Type | Required | Description |
---|---|---|---|
amount | Double | true | Payment amount |
currency | String | true | Payment currency |
customerInformation | Object | true | Customer information object |
firstName | String | true | Customer first name |
lastName | String | true | Customer last name |
middleName | String | true | Customer middle name |
String | true | Customer email | |
phone1 | String | true | Customer phone |
city | String | true | Customer city |
address1 | String | true | Customer address line |
postalCode | String | true | Customer postal code |
state | String | true | Customer state |
country | String | true | Customer country |
ip | String | true | Customer origin IP address |
noPresentCardData | Object | true | Card data object |
cardNumber | String | true | Card number |
cvv | String | true | Security code |
cardholderName | String | true | Cardholder name |
expirationYear | String | true | Card expiration year (YY) |
expirationMonth | String | true | Card expiration month (MM) |
promotion | Object | true | Promotion object |
firstPayment | String | true | First payment month |
month | String | true | Installment |
planType | String | true | Plan type |
Plan Type Options
Plan Type | Description |
---|---|
no_interest | Installment without interest |
interest | Installment with interest |
pay_later | Buy now pay later |
Charge with Token
curl --location --request POST 'https://ecommerce.pmiamericas.net/ecommerce/v2/charge' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data-raw '{
"amount": 178.05,
"noPresentCardData": {
"cvv": "765",
"cardToken": "843551c1-9cd5-48a3-94e2-648a5dcd92bc"
}
}'
The above command returns JSON structured like this:
{
"status": true,
"requestId": "e93cf6e5-03e4-47c0-b054-23d34dcfe978",
"id": "29920",
"date": "2021-01-27",
"time": "16:35:00",
"dataResponse": {
"authorization": "636189",
"description": "APROBADA",
"binInformation": {
"bin": "491566",
"bank": "BANORTE",
"product": "BANORTE ELECTRON",
"type": "DÉBITO",
"brand": "VISA"
},
"reference": "20210127163500770"
}
}
This endpoint process transactions with the card information tokenized.
HTTP Request
POST https://ecommerce.pmiamericas.net/ecommerce/v2/charge
JSON Parameters
Parameter | Type | Required | Description |
---|---|---|---|
amount | Double | true | Payment amount |
currency | String | true | Payment currency |
noPresentCardData | Object | true | Card data object |
cvv | String | true | Security code |
cardToken | String | true | Card token Id |
Tokenization
Add Token
curl --location --request POST 'https://ecommerce.pmiamericas.net/cardToken/add' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data-raw '{
"pan": "4915661111113980",
"expMonth": "12",
"expYear": "2025",
"holderName": "Client Name",
"customerInformation": {
"firstName": "Client Name",
"lastName": "Last Name",
"email": "user@email.om",
"address1": "Av. Mexico",
"city": "Mexico",
"country": "MX",
"ip": "0.0.0.0"
}
}'
The above command returns JSON structured like this:
{
"status": true,
"requestId": "df74c7f5-6979-4716-bde3-17bccf1dd285",
"date": "2021-01-27",
"time": "16:03:44",
"dataResponse": {
"id": "843551c1-9cd5-48a3-94e2-648a5dcd92bc",
"creationDate": "2021-01-27T22:03:44.335+0000"
}
}
This endpoint add a card and returns a token.
HTTP Request
POST https://ecommerce.pmiamericas.net/cardToken/add
JSON Parameters
Parameter | Type | Required | Description |
---|---|---|---|
pan | String | true | Card number |
expMonth | String | true | Expiration month |
expYear | String | true | Expiration year |
holderName | String | true | Cardholder name |
customerInformation | Object | true | Customer information object |
firstName | String | true | Customer first name |
lastName | String | true | Customer last name |
String | true | Customer email | |
address1 | String | true | Customer address |
city | String | true | Customer city |
country | String | true | Customer country |
ip | String | true | Customer origin IP address |
Get Card
curl --location --request GET 'https://ecommerce.pmiamericas.net/cardToken/get/843551c1-9cd5-48a3-94e2-648a5dcd92bc' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.'
The above command returns JSON structured like this:
{
"status": true,
"requestId": "df74c7f5-6979-4716-bde3-17bccf1dd285",
"date": "2021-01-27",
"time": "16:03:44",
"dataResponse": {
"id": "843551c1-9cd5-48a3-94e2-648a5dcd92bc",
"creationDate": "2021-01-27T22:03:44.335+0000"
}
}
This endpoint returns the card data of the token requested.
HTTP Request
GET https://ecommerce.pmiamericas.net/cardToken/get/{tokenId}
Update Card
curl --location --request POST 'https://ecommerce.pmiamericas.net/cardToken/update/843551c1-9cd5-48a3-94e2-648a5dcd92bc' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data-raw '{
"pan": "4915661111113981",
"expMonth": "12",
"expYear": "2025",
"holderName": "Mike Wazowski",
"customerInformation": {
"firstName": "Mike",
"lastName": "Wazowski",
"email": "new_user@email.om",
"address1": "Av. Mexico",
"city": "Mexico",
"country": "MX",
"ip": "0.0.0.0"
}
}'
The above command returns JSON structured like this:
{
"status": true,
"requestId": "41079cb6-2ebb-4515-a838-3e8b21a50025",
"date": "2021-01-27",
"time": "16:29:09",
"dataResponse": {
"id": "843551c1-9cd5-48a3-94e2-648a5dcd92bc",
"creationDate": "2021-01-27T22:03:44.335+0000",
"editDate": "2021-01-27T22:29:10.243+0000"
}
}
This endpoint update the card of the token requested.
HTTP Request
POST https://ecommerce.pmiamericas.net/cardToken/update/{tokenId}
JSON Parameters
Parameter | Type | Required | Description |
---|---|---|---|
pan | String | true | Card number |
expMonth | String | true | Expiration month |
expYear | String | true | Expiration year |
holderName | String | true | Cardholder name |
customerInformation | Object | true | Customer information object |
firstName | String | true | Customer first name |
lastName | String | true | Customer last name |
String | true | Customer email | |
address1 | String | true | Customer address |
city | String | true | Customer city |
country | String | true | Customer country |
ip | String | true | Customer origin IP address |
Recurrence
Add Payment
curl --location --request POST 'https://ecommerce.pmiamericas.net/recurrentPurchase/add' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data-raw '{
"token": "843551c1-9cd5-48a3-94e2-648a5dcd92bc",
"amount": 178.05,
"currency": "484",
"chargeDay": 28,
"chargeNumber": 2,
"startDate": "today"
}'
The above command returns JSON structured like this:
{
"status": true,
"requestId": "7772673f-27b9-4afe-9eea-d01ff6713e14",
"date": "2021-01-27",
"time": "17:00:20",
"dataResponse": {
"id": 242646,
"detail": [
{
"idPlan": 242646,
"idCharge": 555,
"amount": 89.03,
"nextAttempt": "2021-01-27T17:00:20.523"
},
{
"idPlan": 242646,
"idCharge": 556,
"amount": 89.03,
"nextAttempt": "2021-02-28T00:00:00"
}
],
"description": "TRANSACCIÓN GUARDADA"
}
}
This endpoint add a recurrent payment to the card token requested.
HTTP Request
POST https://ecommerce.pmiamericas.net/recurrentPurchase/add
JSON Parameters
Parameter | Type | Required | Description |
---|---|---|---|
token | String | true | Card token id |
amount | Int | true | Recurrent payment amount |
currency | String | true | Payment currency |
chargeDay | Int | true | Day of month to be charged |
chargeNumber | Int | true | Number of payments |
startDate | String | true | When it is going to be charged (today) |
Get Payment
curl --location --request GET 'https://ecommerce.pmiamericas.net/recurrentPurchase/get/242646' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
The above command returns JSON structured like this:
{
"status": true,
"requestId": "8800218d-cece-46c4-b5dd-084f377cc1ad",
"date": "2021-01-27",
"time": "17:06:26",
"dataResponse": {
"card": " ****3980",
"amount": 178.05,
"currency": "484",
"chargeDay": 28,
"chargeNumber": 2,
"currentCharge": 1,
"detail": [
{
"idPlan": 242646,
"idCharge": 555,
"amount": 89.03,
"nextAttempt": "2021-01-27T17:00:20.523",
"status": "PAGADA"
},
{
"idPlan": 242646,
"idCharge": 556,
"amount": 89.03,
"nextAttempt": "2021-02-28T00:00:00",
"status": "PENDIENTE"
}
]
}
}
This endpoint returns the payment registered.
HTTP Request
GET https://ecommerce.pmiamericas.net/recurrentPurchase/get/{paymentId}
Update Payment
curl --location --request POST https://ecommerce.pmiamericas.net/recurrentPurchase/update/242646' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...' \
--header 'Content-Type: application/json' \
--data-raw '{
"token": "843551c1-9cd5-48a3-94e2-648a5dcd92bc",
"chargeDay": 27,
"startDate": "2021-01-27"
}'
The above command returns JSON structured like this:
{
"status": true,
"requestId": "e9340033-7c50-4199-a2df-0410d815c677",
"date": "2021-01-27",
"time": "17:10:48",
"dataResponse": {
"id": 242646,
"description": "TRANSACCIÓN ACTUALIZADA"
}
}
This endpoint update a recurrent payment.
HTTP Request
POST https://ecommerce.pmiamericas.net/recurrentPurchase/update/{paymentId}
JSON Parameters
Parameter | Type | Required | Description |
---|---|---|---|
token | String | true | Card token id |
chargeDay | Int | true | Day of month to be charged |
startDate | String | true | When it is going to be charged |
Delete Payment
curl --location --request GET 'https://ecommerce.pmiamericas.net/recurrentPurchase/delete/242646' \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...'
The above command returns JSON structured like this:
{
"status": true,
"requestId": "a97fb81c-4061-4e5d-9a75-178ae642a7a4",
"date": "2021-01-27",
"time": "17:14:51",
"dataResponse": {
"description": "TRANSACCIÓN DESACTIVADA"
}
}
This endpoint returns the payment registered.
HTTP Request
GET https://ecommerce.pmiamericas.net/recurrentPurchase/delete/{paymentId}
WebHooks
JSON structure returned in transactions:
{
"bin": "411111",
"lastFour": "1111",
"cardType": "DEBITO",
"brand": "VISA",
"bank": "BANORTE",
"amount": "1.23",
"reference": "20210120182438251",
"cardHolder": "Client Name",
"authorizationCode": "483347",
"operationType": "VENTA",
"operationNumber": 29556,
"descriptionResponse": "APROBADA",
"dateTransaction": "20/01/2021 18:24:38",
"authentication": "unknown",
"membership": "8226471",
"provideResponse": "SB",
"codeResponse": "00"
}
This tool allow you to receive the transaction response related to your merchant. If your transaction loses the frontend flow you can get the response in real time on a specific endpoint.
Parameter | Type | Required | Description |
---|---|---|---|
bin | String | true | Card bin |
lastFour | String | true | Card last 4 digits |
cardType | String | true | Card type |
brand | String | true | Card brand |
bank | String | true | Card bank |
amount | String | true | Payment amount |
reference | String | true | Payment reference |
cardHolder | String | true | Cardholder name |
authorizationCode | String | true | Payment authorization code |
operationType | Integer | true | Operation type |
operationNumber | String | true | Operation number |
descriptionResponse | String | true | Payment description |
dateTransaction | String | true | Payment date |
authentication | String | true | Payment authentication type |
membership | String | true | Merchant id |
provideResponse | String | true | Provider |
codeResponse | String | true | Response code |
Errors
The API uses the following error codes:
Error Code | Meaning |
---|---|
400 | Bad Request -- Your request is invalid. |
401 | Unauthorized -- Your API key is wrong. |
403 | Forbidden -- The kitten requested is hidden for administrators only. |
404 | Not Found -- The specified kitten could not be found. |
405 | Method Not Allowed -- You tried to access a kitten with an invalid method. |
406 | Not Acceptable -- You requested a format that isn't json. |
410 | Gone -- The kitten requested has been removed from our servers. |
418 | I'm a teapot. |
429 | Too Many Requests -- You're requesting too many kittens! Slow down! |
500 | Internal Server Error -- We had a problem with our server. Try again later. |
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |