Introduction
Endpoints
# Production
https://api.gamecash.mx/
# Sandbox
https://sandbox-api.gamecash.mx/
The GameCash API is constructed around REST, it contains predictable URLs oriented to resources, responds in JSON code using HTTP responses, and standard verbs and authentication.
Authentication
curl -u sk_z8A4Fje1yDM5q9He2
<?php
require 'vendor/autoload.php';
$headers = [
'auth' => [ 'sk_z8A4Fje1yDM5q9He2', ],
];
$request_body = [];
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', '{{endpoint}}', [
'headers' => $headers,
'json' => $request_body,
]);
Must replace
sk_z8A4Fje1yDM5q9He2
with your API key.
The GameCash API needs API keys to authenticate requests.
The authentication type is HTTP Basic Authorization. Use your API key as your as your basic auth, password is not needed.
All API Calls must be made using HTTPS, all calls using HTTP or without AUTH will fail.
Authorization: sk_z8A4Fje1yDM5q9He2
RESPONSES
401 Unauthorized
{
"message": "Invalid authentication credentials.",
"status_code": 401
}
Responses
Code | Description |
---|---|
401 | Unauthorized |
Orders
The Order Object
THE ORDER OBJECT
{
"id": "ord_KQK3JBnwOjXwZo",
"object": "order",
"description": "Prueba de pago en OXXO.",
"amount": 134999,
"status": "paid",
"customer": {
"id": "cus_0G9wK1LBy7A0X3",
"object": "customer",
"firstname": "Roberto",
"lastname": "Ramirez",
"email": "robertoiran@example.com",
"phone": "+5215555555555"
},
"payment_method": {
"data": [
{
"id": "och_AgpDB9PYR4RJyYD",
"reference": "64000000003320022901349997",
"type": "oxxo",
"status": "paid",
"expires_at": 1583013067,
"paid_at": 1578687860,
"error_code": null,
"error_message": null,
"created_at": 1578681919,
"updated_at": 1578687862
}
]
},
"operation_type": "in",
"refunds": {
"id": "re_84xQBdd2JkJzzEd7",
"amount": 134999,
"reason": "requested_by_customer",
"status": "in_review",
"refunded_at": null,
"created_at": 1578687876
},
"paid_at": 1578687860,
"metadata": {
"order_id": 231008
},
"created_at": 1578681919,
"updated_at": 1578687862,
"links": {
"receipt_payment": "https://admin.gamecash.mx/receipt-payment/ord_KQK3JBnwOjXwZo"
}
}
Atributtes | Description |
---|---|
id | Order ID. string |
description | Order description. string, required, maxLength=250 |
amount | Amount in cents. integer, required |
status | Order status. Possible values pending_payment , declined , expired , paid , refunded , voided , error .string |
customer | Hash that contains the customer information. Hash |
id > customer |
Customer ID. string |
firstname > customer |
Customer name. string, required, minLength=3, maxLength=250 |
lastname > customer |
Customer last name. string, required, minLength=3, maxLength=250 |
email > customer |
Customer email. string, required |
phone > customer |
Customer phone. string |
payment_method | List of the charges generated in an order. List |
id > payment_method |
Payment Method ID. string |
type > payment_method |
Payment method type. Possible values oxxo , spei , paynet , oxxopay .string |
reference > payment_method |
Reference code to make deposit, for SPEI you would get a CLABE and for stores you would get a barcode. string |
status > payment_method |
Charge status. Possible values pending_payment , declined , expired , paid , error .string |
expires_at > payment_method |
Charge expirations date. 32-bit unix timestamp |
paid_at > payment_method |
Date where the payment of the charge was made. 32-bit unix timestamp |
error_code > payment_method |
Error code. string |
error_message > payment_method |
Error description. string |
created_at > payment_method |
Payment method creation date. 32-bit unix timestamp |
updated_at > payment_method |
Payment method last update date. 32-bit unix timestamp |
refunds | Hash that contains the refund information. Hash |
id > refunds |
Refund ID. string |
amount > refunds |
Amount in cents. integer |
reason > refunds |
Indicates the refund issue. Possible values duplicate , fraudulent , requested_by_customer , other .string |
status > refunds |
Refund Status. Possible values completed , declined , expired , paid , refunded , voided , error .string |
refunded_at > refunds |
Date and time when the refund was executed. 32-bit unix timestamp |
created_at > refunds |
Refund creation date. 32-bit unix timestamp |
paid_at | Payment date of the order. 32-bit unix timestamp |
metadata | Hash where additional information of the order can be sent. You can specify up to 50 elements, with key names up to 40 characters and values up to 500 characters. Hash |
created_at | Order creation date. 32-bit unix timestamp |
updated_at | Date of the last order update. 32-bit unix timestamp |
links | Order links. Hash |
receipt_payment > links |
Link to download the PDF payment format. The downloaded receipt contains references and instructions needed to make a cash deposit at available stores. string |
Create an order
POST /orders
curl -X POST \
https://api.gamecash.mx/orders \
-H 'Content-Type: application/json' \
-u sk_z8A4Fje1yDM5q9He2: \
-d '{
"amount": 134999,
"description": "Prueba de pago en OXXO.",
"customer": {
"firstname": "Roberto",
"lastname": "Ramirez",
"email": "robertoiran@example.com"
},
"payment_method": {
"type": "oxxo",
"expires_at": "1583013067"
},
"metadata": {
"order_id": 231008
}
}'
<?php
require 'vendor/autoload.php';
$headers = [
'Content-Type' => 'application/json',
'auth' => [ 'sk_z8A4Fje1yDM5q9He2', ],
];
$request_body = [
'amount' => 134999,
'description' => 'Prueba de pago en OXXO.',
'customer' => [
'firstname' => 'Roberto',
'lastname' => 'Ramirez',
'email' => 'robertoiran@example.com',
],
'payment_method' => [
'type' => 'oxxo',
'expires_at' => '1583013067',
],
"metadata": {
"order_id": 231008
}
];
$client = new \GuzzleHttp\Client();
try {
$response = $client->request('POST','https://api.gamecash.mx/orders', [
'headers' => $headers,
'json' => $request_body,
]);
print_r($response->getBody()->getContents());
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
print_r($e->getMessage());
}
Create a new order
Parmeter | Description |
---|---|
description | Order description. string, required, maxLength=250 |
amount | Amount in cents. integer, required |
customer | Hash that contains the customer information. Hash |
firstname > customer |
Customer name. string, required, minLength=3, maxLength=250 |
lastname > customer |
Customer last name. string, required, minLength=3, maxLength=250 |
email > customer |
Customer email. string, required |
payment_method | List of the charges generated in an order. List |
type > payment_method |
Payment method type. Possible values oxxo , spei , paynet , oxxopay .string |
expires_at > payment_method |
Charge expirations date. 32-bit unix timestamp |
metadata | Hash where additional information of the order can be sent. You can specify up to 50 elements, with key names up to 40 characters and values up to 500 characters. Hash |
RESPONSES
200 OK
{
"id": "ord_KQK3JBnwOjXwZo",
"object": "order",
"description": "Prueba de pago en OXXO.",
"amount": 134999,
"status": "pending_payment",
"customer": {
"id": "cus_0G9wK1LBy7A0X3",
"object": "customer",
"firstname": "Roberto",
"lastname": "Ramirez",
"email": "robertoiran@example.com",
"phone": "+5215555555555"
},
"payment_method": {
"data": [
{
"id": "och_AgpDB9PYR4RJyYD",
"reference": "64000000003320022901349997",
"type": "oxxo",
"status": "pending_payment",
"expires_at": 1583013067,
"paid_at": null,
"error_code": null,
"error_message": null,
"created_at": 1578681919,
"updated_at": 1578681919
}
]
},
"operation_type": "in",
"refunds": [],
"paid_at": null,
"metadata": {
"order_id": 231008
},
"created_at": 1578681919,
"updated_at": 1578681919,
"links": {
"receipt_payment": "https://admin.gamecash.mx/receipt-payment/ord_KQK3JBnwOjXwZo"
}
}
422 Unprocessable Entity
{
"message": "422 Unprocessable Entity",
"errors": {
"customer.email": [
"El campo customer.email es obligatorio."
]
},
"code": "validation_errors",
"status_code": 422
}
Responses
Code | Description |
---|---|
200 | OK |
422 | Unprocessable Entity |
Retrieve an order
GET /orders/:id
curl https://api.gamecash.mx/orders/ord_KQK3JBnwOjXwZo \
-u sk_z8A4Fje1yDM5q9He2:
<?php
require 'vendor/autoload.php';
$headers = [
'auth' => [ 'sk_z8A4Fje1yDM5q9He2', ],
];
$client = new \GuzzleHttp\Client();
try {
$response = $client->request('GET','https://api.gamecash.mx/orders/ord_KQK3JBnwOjXwZo', [
'headers' => $headers,
]);
print_r($response->getBody()->getContents());
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
print_r($e->getMessage());
}
Retrieves a previously created order details. Please indicate the order ID that were given in the order creation response. Order information will be returned as well when creating or refunding an order.
Parameters
Parmeter | Description |
---|---|
id | Order ID. string |
RESPONSES
200 OK
{
"id": "ord_KQK3JBnwOjXwZo",
"object": "order",
"description": "Prueba de pago en OXXO.",
"amount": 134999,
"status": "pending_payment",
"customer": {
"id": "cus_0G9wK1LBy7A0X3",
"object": "customer",
"firstname": "Roberto",
"lastname": "Ramirez",
"email": "robertoiran@example.com",
"phone": "+5215555555555"
},
"payment_method": {
"data": [
{
"id": "och_AgpDB9PYR4RJyYD",
"reference": "64000000003320022901349997",
"type": "oxxo",
"status": "pending_payment",
"expires_at": 1583013067,
"paid_at": null,
"error_code": null,
"error_message": null,
"created_at": 1578681919,
"updated_at": 1578681919
}
]
},
"operation_type": "in",
"refunds": [],
"paid_at": null,
"created_at": 1578681919,
"updated_at": 1578681919,
"links": {
"receipt_payment": "https://admin.gamecash.mx/receipt-payment/ord_KQK3JBnwOjXwZo"
}
}
404 Not Found
{
"message": "No such resource: ord_KQK3JBnwOjXwZos",
"code": "resource_missing_error",
"status_code": 404
}
Responses
Code | Description |
---|---|
200 | OK |
404 | Not Found |
Refund an order
POST /orders/refunds
curl -X POST \
https://api.gamecash.mx/orders/refunds \
-H 'Content-Type: application/json' \
-u sk_z8A4Fje1yDM5q9He2: \
-d '[
{
"order_id": "ord_KQK3JBnwOjXwZo",
"reason": "requested_by_customer",
"method": "spei"
"bank_account": {
"bank_code": 40002,
"clabe": "489093653610032428"
}
}
]'
<?php
require 'vendor/autoload.php';
$headers = [
'Content-Type' => 'application/json',
'auth' => [ 'sk_z8A4Fje1yDM5q9He2', ],
];
$request_body = [
{
'order_id' : 'ord_KQK3JBnwOjXwZo',
'reason' : 'requested_by_customer',
'method' : 'spei',
"bank_account": {
"bank_code": 40002,
"clabe": "489093653610032428"
}
}
];
$client = new \GuzzleHttp\Client();
try {
$response = $client->request('POST','https://api.gamecash.mx/orders/refunds', [
'headers' => $headers,
'json' => $request_body,
]);
print_r($response->getBody()->getContents());
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
print_r($e->getMessage());
}
Parameters
Parmeter | Description |
---|---|
order_id | Order ID. string, required |
reason | Indicates the refund issue. Possible values duplicate , fraudulent , requested_by_customer , other .string |
method | Method by which the instruction will be executed. Possible values spei string, required |
bank_account | Hash containing the customer's banking information, must be present for the method spei, required .Hash |
bank_code > bank_account |
The code of the institution to which the payment is directed according to the Catalog Institutions. integer, required |
clabe > bank_account |
CLABE customer interbank string, required |
RESPONSES
200 OK
{
"id": "ord_KQK3JBnwOjXwZo",
"object": "order",
"description": "Prueba de pago en OXXO.",
"amount": 134999,
"status": "paid",
"customer": {
"id": "cus_0G9wK1LBy7A0X3",
"object": "customer",
"firstname": "Roberto",
"lastname": "Ramirez",
"email": "robertoiran@example.com",
"phone": "+5215555555555"
},
"payment_method": {
"data": [
{
"id": "och_AgpDB9PYR4RJyYD",
"reference": "64000000003320022901349997",
"type": "oxxo",
"status": "paid",
"expires_at": 1583013067,
"paid_at": 1578687860,
"error_code": null,
"error_message": null,
"created_at": 1578681919,
"updated_at": 1578687862
}
]
},
"operation_type": "in",
"refunds": {
"id": "re_84xQBdd2JkJzzEd7",
"amount": 134999,
"reason": "requested_by_customer",
"status": "in_review",
"refunded_at": null,
"created_at": 1578687876
},
"paid_at": 1578687860,
"created_at": 1578681919,
"updated_at": 1578687862,
"links": {
"receipt_payment": "https://admin.gamecash.mx/receipt-payment/ord_KQK3JBnwOjXwZo"
}
}
404 Not Found
{
"message": "No such resource: ord_KQK3JBnwOjXwZos",
"code": "resource_missing_error",
"status_code": 404
}
Responses
Code | Description |
---|---|
200 | OK |
404 | Not Found |
Dispersions
The Dispersion Object
THE DISPERSION OBJECT
{
"id": "dsp_mPgYQzE5B8rypJyK4oMvr",
"object": "dispersion",
"amount": 1018676,
"status": "pending_payment",
"payment_method": {
"id": "och_HdT7LmkRRDlbCNMjw0lnj",
"reference": "646180179900000014",
"type": "spei",
"status": "pending_payment",
"expires_at": null,
"paid_at": null,
"error_code": null,
"error_message": null,
"created_at": 1594915607,
"updated_at": 1594915607
},
"finished_at": null,
"canceled_at": null,
"created_at": 1594915607,
"updated_at": 1594915607,
"instructions": {
"object": "list",
"data": [
{...},
{...},
{...}
],
"url": "/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr/instructions",
"has_more": false,
"total": 3
}
}
Atributtes | Description |
---|---|
id | Dispersion unique ID. string |
object | Object type. string |
amount | Amount in cents. The value is calculated adding the dispersions amount + the transaction cost. integer |
status | EDispersion status. PPosible values pending_payment , running , finished , canceled .string |
payment_method | Hash that contains the information to fund the dispersion. Hash |
id > payment_method |
Payment Method ID. string |
reference > payment_method |
CLABE account to fund the dispersion. string |
type > payment_method |
Payment Method Type. string |
status > payment_method |
Charge status. Posible values pending_payment , declined , expired , paid , error .string |
expires_at > payment_method |
Expiration of the charge. 32-bit unix timestamp |
paid_at > payment_method |
Payment date. 32-bit unix timestamp |
error_code > payment_method |
Error Code. string |
error_message > payment_method |
Error description. string |
created_at > payment_method |
Payment method creation date. 32-bit unix timestamp |
updated_at > payment_method |
Date of the last payment method update. 32-bit unix timestamp |
finished_at | Date where the dispersion finished all the transfers. 32-bit unix timestamp |
canceled_at | Date where the dispersion was cancelled. 32-bit unix timestamp |
created_at | Dispersion creation date. 32-bit unix timestamp |
updated_at | Date of the last update of the dispersion. 32-bit unix timestamp |
instructions | Instructions list. list |
Create a dispersion
POST /dispersions
curl -X POST \
https://api.gamecash.mx/dispersions \
-H 'Content-Type: application/json' \
-u sk_z8A4Fje1yDM5q9He2: \
-d '[
{
"description": "Descripción de instrucción por spei.",
"amount": 218847,
"method": "spei",
"customer": {
"firstname": "Gia",
"lastname": "Carter",
"email": "vidal49@example.com",
"phone": "5594546531"
},
"bank_account": {
"bank_code": 40002,
"clabe": "489093653610032428"
},
"metadata": {
"order_id": "3381"
}
},
{
"description": "Descripción de instrucción por servicio.",
"amount": 10000,
"method": "service",
"customer": {
"firstname": "Damian",
"lastname": "Ramírez",
"email": "dramirez@example.com"
},
"service": {
"service_code": 64,
"product_code": 193,
"reference": "5555555555"
}
"metadata": {
"order_id": "3382"
}
},
{...},
{...}
]'
<?php
require 'vendor/autoload.php';
$headers = [
'Content-Type' => 'application/json',
'auth' => [ 'sk_z8A4Fje1yDM5q9He2', ],
];
$request_body = [
{
"description": "Descripción de instrucción por spei.",
"amount": 218847,
"method": "spei",
"customer": {
"firstname": "Gia",
"lastname": "Carter",
"email": "vidal49@example.com",
"phone": "5594546531"
},
"bank_account": {
"bank_code": 40002,
"clabe": "489093653610032428"
},
"metadata": {
"order_id": "3381"
}
},
{
"description": "Descripción de instrucción por servicio.",
"amount": 10000,
"method": "service",
"customer": {
"firstname": "Damian",
"lastname": "Ramírez",
"email": "dramirez@example.com"
},
"service": {
"service_code": 64,
"product_code": 193,
"reference": "5555555555"
}
"metadata": {
"order_id": "3382"
}
},
{...},
{...}
];
$client = new \GuzzleHttp\Client();
try {
$response = $client->request('POST','https://api.gamecash.mx/dispersions', [
'headers' => $headers,
'json' => $request_body,
]);
print_r($response->getBody()->getContents());
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
print_r($e->getMessage());
}
A matrix with one or more instructions objects is sent.
Parmeter | Description |
---|---|
description | Instruction description. string, required, maxLength=40 |
amount | Amount in cents, the minimum amount for SPEI transfers is $200.00 MXN. integer, required, min=20000 |
method | Execution method for the instruction. Possible values spei , service .string |
customer | Hash that contains the customer information. Hash |
firstname > customer |
Customer name. string, required, minLength=3, maxLength=250 |
lastname > customer |
Customer last name. string, required, minLength=3, maxLength=250 |
email > customer |
Customer email. string, required |
phone > customer |
Customer phone. string, length=10 |
bank_account | Hash that contains the bank information of the customer, should be present for SPEI method. Hash |
bank_code > bank_account |
The bank institution to where the payment is being sent according with the Bank Institution Catalog. integer, required |
clabe > bank_account |
CLABE account of the customer. string, required |
service | Hash that contains the service information, Must be present service method.Hash |
service_code > service |
The service code according to Products and Services Catalog. integer |
product_code > service |
The product code according to Products and Services Catalog. integer |
reference > service |
Phone number or reference. string |
metadata | Hash where additional information can be sent in the instruction. You can specify up to 50 elements, with key names up to 40 characters and values up to 500 characters. Hash |
RESPONSES
200 OK
{
"id": "dsp_mPgYQzE5B8rypJyK4oMvr",
"object": "dispersion",
"amount": 1018676,
"status": "pending_payment",
"payment_method": {
"id": "och_HdT7LmkRRDlbCNMjw0lnj",
"reference": "646180179900000014",
"type": "spei",
"status": "pending_payment",
"expires_at": null,
"paid_at": null,
"error_code": null,
"error_message": null,
"created_at": 1594915607,
"updated_at": 1594915607
},
"finished_at": null,
"canceled_at": null,
"created_at": 1594915607,
"updated_at": 1594915607,
"instructions": {
"object": "list",
"data": [
{
"id": "ins_WBM7q29vEpg5abGnRZgjd",
"object": "instruction",
"dispersion": "dsp_mPgYQzE5B8rypJyK4oMvr",
"description": "Descripción de instrucción por spei.",
"amount": 218847,
"method": "spei",
"customer": {
"firstname": "Gia",
"lastname": "Carter",
"email": "vidal49@example.com",
"phone": "5594546531"
},
"bank_account": {
"bank_code": 40002,
"clabe": "489093653610032428"
},
"metadata": {
"order_id": "3381"
},
"error": {
"message": null
},
"external_id": null,
"status": "pending",
"paid_at": null,
"created_at": 1594915607,
"updated_at": 1594915607
},
{
"id": "ins_7q29vbGnpg5ajdWBMRZgE",
"object": "instruction",
"dispersion": "dsp_mPgYQzE5B8rypJyK4oMvr",
"description": "Descripción de instrucción por servicio.",
"amount": 10000,
"method": "service",
"customer": {
"firstname": "Damian",
"lastname": "Ramírez",
"email": "dramirez@example.com"
},
"service": {
"service_code": 64,
"product_code": 193,
"reference": "5555555555"
}
"metadata": {
"order_id": "3382"
},
"error": {
"message": null
},
"external_id": null,
"status": "pending",
"paid_at": null,
"created_at": 1594915607,
"updated_at": 1594915607
},
{...},
{...}
],
"url": "/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr/instructions",
"has_more": false,
"total": 4
}
}
422 Unprocessable Entity
{
"message": "422 Unprocessable Entity",
"errors": {
"0.amount": [
"El monto mínimo es de 20000 centavos."
]
},
"code": "validation_errors",
"status_code": 422
}
Responses
Code | Description |
---|---|
200 | OK |
422 | Unprocessable Entity |
Retrieve a dispersion
GET /dispersions/:id
curl https://api.gamecash.mx/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr \
-u sk_z8A4Fje1yDM5q9He2:
<?php
require 'vendor/autoload.php';
$headers = [
'auth' => [ 'sk_z8A4Fje1yDM5q9He2', ],
];
$client = new \GuzzleHttp\Client();
try {
$response = $client->request('GET','https://api.gamecash.mx/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr', [
'headers' => $headers,
]);
print_r($response->getBody()->getContents());
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
print_r($e->getMessage());
}
Retrieves the details from a previously created dispersion, the returned value is a dispersion object.
Parameters
Parmeter | Description |
---|---|
id | Dispersion unique ID. string |
RESPONSES
200 OK
{
"id": "dsp_mPgYQzE5B8rypJyK4oMvr",
"object": "dispersion",
"amount": 1018676,
"status": "pending_payment",
"payment_method": {
"id": "och_HdT7LmkRRDlbCNMjw0lnj",
"reference": "646180179900000014",
"type": "spei",
"status": "pending_payment",
"expires_at": null,
"paid_at": null,
"error_code": null,
"error_message": null,
"created_at": 1594915607,
"updated_at": 1594915607
},
"finished_at": null,
"canceled_at": null,
"created_at": 1594915607,
"updated_at": 1594915607,
"instructions": {
"object": "list",
"data": [
{
"id": "ins_WBM7q29vEpg5abGnRZgjd",
"object": "instruction",
"dispersion": "dsp_mPgYQzE5B8rypJyK4oMvr",
"description": "Descripción de la instrucción.",
"amount": 218847,
"method": "spei",
"customer": {
"firstname": "Gia",
"lastname": "Carter",
"email": "vidal49@example.com",
"phone": "5594546531"
},
"bank_account": {
"bank_code": 40002,
"clabe": "489093653610032428"
},
"metadata": {
"order_id": "3381"
},
"error": {
"message": null
},
"external_id": null,
"status": "pending",
"paid_at": null,
"created_at": 1594915607,
"updated_at": 1594915607
},
{...},
{...}
],
"url": "/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr/instructions",
"has_more": false,
"total": 3
}
}
404 Not Found
{
"message": "No such resource: dsp_mPgYQzE5B8rypJyK4oMvr",
"code": "resource_missing_error",
"status_code": 404
}
Responses
Code | Description |
---|---|
200 | OK |
404 | Not Found |
Cancel a dispersion.
POST /dispersions/:id/cancel
curl -X POST https://api.gamecash.mx/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr/cancel \
-u sk_z8A4Fje1yDM5q9He2:
<?php
require 'vendor/autoload.php';
$headers = [
'auth' => [ 'sk_z8A4Fje1yDM5q9He2', ],
];
$client = new \GuzzleHttp\Client();
try {
$response = $client->request('POST','https://api.gamecash.mx/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr/cancel', [
'headers' => $headers,
]);
print_r($response->getBody()->getContents());
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
print_r($e->getMessage());
}
A dispersion can be cancelled if it has not already been funded.
Parameters
Parmeter | Description |
---|---|
id | Dispersion unique ID. string |
RESPONSES
200 OK
{
"id": "dsp_mPgYQzE5B8rypJyK4oMvr",
"object": "dispersion",
"amount": 1018676,
"status": "canceled",
"payment_method": {
"id": "och_HdT7LmkRRDlbCNMjw0lnj",
"reference": "646180179900000014",
"type": "spei",
"status": "pending_payment",
"expires_at": null,
"paid_at": null,
"error_code": null,
"error_message": null,
"created_at": 1594915607,
"updated_at": 1594915607
},
"finished_at": null,
"canceled_at": 1594994461,
"created_at": 1594915607,
"updated_at": 1594915607,
"instructions": {
"object": "list",
"data": [
{
"id": "ins_WBM7q29vEpg5abGnRZgjd",
"object": "instruction",
"dispersion": "dsp_mPgYQzE5B8rypJyK4oMvr",
"description": "Descripción de la instrucción.",
"amount": 218847,
"method": "spei",
"customer": {
"firstname": "Gia",
"lastname": "Carter",
"email": "vidal49@example.com",
"phone": "5594546531"
},
"bank_account": {
"bank_code": 40002,
"clabe": "489093653610032428"
},
"metadata": {
"order_id": "3381"
},
"error": {
"message": null
},
"external_id": null,
"status": "canceled",
"paid_at": null,
"created_at": 1594915607,
"updated_at": 1594915607
},
{...},
{...}
],
"url": "/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr/instructions",
"has_more": false,
"total": 3
}
}
404 Not Found
{
"message": "No such resource: dsp_mPgYQzE5B8rypJyK4oMvr",
"code": "resource_missing_error",
"status_code": 404
}
Responses
Code | Description |
---|---|
200 | OK |
404 | Not Found |
Instructions
The Instruction object
THE INSTRUCTION OBJECT
{
"id": "ins_WBM7q29vEpg5abGnRZgjd",
"object": "instruction",
"dispersion": "dsp_mPgYQzE5B8rypJyK4oMvr",
"description": "Descripción de la instrucción.",
"amount": 218847,
"method": "spei",
"customer": {
"firstname": "Gia",
"lastname": "Carter",
"email": "vidal49@example.com",
"phone": "5594546531"
},
"bank_account": {
"bank_code": 40002,
"clabe": "489093653610032428"
},
"service": {
"service_code": 64,
"product_code": 193,
"reference": "5555555555"
}
"metadata": {
"order_id": "3381"
},
"error": {
"message": null
},
"external_id": null,
"status": "pending",
"paid_at": null,
"created_at": 1594915607,
"updated_at": 1594915607
}
Atributtes | Description |
---|---|
id | Instruction ID. string |
object | Object Type. string |
dispersion | Dispersion ID. string |
description | Instruction description. string, required, maxLength=40 |
amount | Amount in cents, the minimum amount for SPEI transfers is $200.00 MXN. integer, required, min=20000 |
method | Execution method for the instruction. Possible values spei , service .string |
customer | Hash that contains the customer information. Hash |
firstname > customer |
Customer name. string, required, minLength=3, maxLength=250 |
lastname > customer |
Customer last name. string, required, minLength=3, maxLength=250 |
email > customer |
Customer email. string, required |
phone > customer |
Customer phone. string, length=10 |
bank_account | Hash that contains the bank information of the customer, should be present for SPEI method. Hash |
bank_code > bank_account |
The bank institution to where the payment is being sent according with the Bank Institution Catalog. integer, required |
clabe > bank_account |
CLABE account of the customer. string, required |
service | Hash that contains the service information, Must be present service method.Hash |
service_code > service |
The service code according to Products and Services Catalog. integer |
product_code > service |
The product code according to Products and Services Catalog. integer |
reference > service |
Phone number or reference. string |
metadata | Hash where additional information can be sent in the instruction. You can specify up to 50 elements, with key names up to 40 characters and values up to 500 characters. Hash |
error | Hash that contains the error information. Hash |
message > error |
Error message of why the dispersion failed. string |
external_id | Dispersion tracking code. string |
status | Instruction status. Possible values pending , in_transit , paid , failed , canceled , refunded .string |
paid_at | Date where the instruction was executed (dispersed). 32-bit unix timestamp |
created_at | Instruction creation date. 32-bit unix timestamp |
updated_at | Date of the last instruction update. 32-bit unix timestamp |
Instructions list
GET /dispersions/:id/instructions
curl https://api.gamecash.mx/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr/instructions \
-u sk_z8A4Fje1yDM5q9He2:
<?php
require 'vendor/autoload.php';
$headers = [
'auth' => [ 'sk_z8A4Fje1yDM5q9He2', ],
];
$client = new \GuzzleHttp\Client();
try {
$response = $client->request('GET','https://api.gamecash.mx/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr/instructions', [
'headers' => $headers,
]);
print_r($response->getBody()->getContents());
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
print_r($e->getMessage());
}
Retrieves a list of instructions associated with a dispersion.
Parameters
Parmeter | Description |
---|---|
id | Instruction ID. string |
RESPONSES
200 OK
{
"object": "list",
"data": [
{
"id": "ins_WBM7q29vEpg5abGnRZgjd",
"object": "instruction",
"dispersion": "dsp_mPgYQzE5B8rypJyK4oMvr",
"description": "Descripción de la instrucción.",
"amount": 218847,
"method": "spei",
"customer": {
"firstname": "Gia",
"lastname": "Carter",
"email": "vidal49@example.com",
"phone": "5594546531"
},
"bank_account": {
"bank_code": 40002,
"clabe": "489093653610032428"
},
"metadata": {
"order_id": "3381"
},
"error": {
"message": null
},
"external_id": null,
"status": "pending",
"paid_at": null,
"created_at": 1594915607,
"updated_at": 1594915607
},
{...},
{...}
],
"url": "/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr/instructions",
"has_more": false,
"total": 3
}
404 Not Found
{
"message": "No such resource: dsp_mPgYQzE5B8rypJyK4oMvr",
"code": "resource_missing_error",
"status_code": 404
}
Responses
Code | Description |
---|---|
200 | OK |
404 | Not Found |
Retrieve an instruction
GET /dispersions/:id/instructions/:id
curl https://api.gamecash.mx/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr/instructions/ins_WBM7q29vEpg5abGnRZgjd \
-u sk_z8A4Fje1yDM5q9He2:
<?php
require 'vendor/autoload.php';
$headers = [
'auth' => [ 'sk_z8A4Fje1yDM5q9He2', ],
];
$client = new \GuzzleHttp\Client();
try {
$response = $client->request('GET','https://api.gamecash.mx/dispersions/dsp_mPgYQzE5B8rypJyK4oMvr/instructions/ins_WBM7q29vEpg5abGnRZgjd', [
'headers' => $headers,
]);
print_r($response->getBody()->getContents());
} catch (\GuzzleHttp\Exception\BadResponseException $e) {
print_r($e->getMessage());
}
Retrieves the details of a previously created instruction, el vthe returned value is an instruction object.
Parameters
Parmeter | Description |
---|---|
id | Dispersion unique ID. string |
id | Instruction ID. string |
RESPONSES
200 OK
{
"id": "ins_WBM7q29vEpg5abGnRZgjd",
"object": "instruction",
"dispersion": "dsp_mPgYQzE5B8rypJyK4oMvr",
"description": "Descripción de la instrucción.",
"amount": 218847,
"method": "spei",
"customer": {
"firstname": "Gia",
"lastname": "Carter",
"email": "vidal49@example.com",
"phone": "5594546531"
},
"bank_account": {
"bank_code": 40002,
"clabe": "489093653610032428"
},
"metadata": {
"order_id": "3381"
},
"error": {
"message": null
},
"external_id": null,
"status": "pending",
"paid_at": null,
"created_at": 1594915607,
"updated_at": 1594915607
}
404 Not Found
{
"message": "No such resource: ins_WBM7q29vEpg5abGnRZgjd",
"code": "resource_missing_error",
"status_code": 404
}
Responses
Code | Description |
---|---|
200 | OK |
404 | Not Found |
Pagination
A list represents a group of objects.
The List Object
THE LIST OBJECT
{
"object": "list",
"data": [
{...},
{...},
{...}
],
"url": "...",
"has_more": false,
"total": 3
"previous_page": "..."
"next_page": "..."
}
Atributtes | Description |
---|---|
object | Chain that describes the returned object. string |
data | Matrix that contains the elements. array |
url | UURL to access the list. string |
has_more | Indicates if are any available elements in this group If the response is false, it means the end of the list. boolean |
total | Total elements showed in the group. integer |
previous_page | Last Page URL. string |
next_page | Next page URL string |
Eventos
GameCash will notify all the events that happened in your account. When an event occurs, we create a new object. (eg. When a payment is don we create the event order.paid
.
We use webhook notifications to send the data direct to your server, you can manage web hooks at your merchant panel. If we are unable to get a succesfull response from your server (2xx code) we will resend the webhook 10 seconds later. If second attempt fails, we will retry one last time in 100 seconds. Also web hook could be marked as invalid if the response takes longer than 3 seconds or the SSL is invalid.
The Event Object
THE EVENT OBJECT
{
"object": "event",
"type": "order.paid",
"event_date": 1596029094,
"data": { ... }
}
Atributtes | Description |
---|---|
object | Object Type. string |
type | Event type (eg. order.paid o order.refunded). string |
event_date | Event creation date. 32-bit unix timestamp |
data | Hash that contains the object associated with the event. Hash |
Event Types
This is an updated list, however, new events could be created in the future, so check back later to keep your integration at full.E
Event | Description |
---|---|
order.paid | This event occurs when an order has been paid, includes the object order. |
dispersion.created | This event occurs when a dispersion has been registered, it includes the object Dispersion. |
dispersion.finished | This event occurs when all the instructions contained in a dispersion had been executed. |
instruction.created | This event occurs when an instructions has been registered. Includes object Instruction. |
instruction.in_transit | This event occurs when an instructions has been sent to bank institutions, includes the object instruction. |
instruction.paid | This event occurs when a instructions has been executed or liquidated, includes the object instruction. |
instruction.canceled | This event occurs when there is unusual behavior in one of the involved accounts. The cancellation issues are: * Account cancelled or blocked * Do not complies with CNBV anti money laundering laws. Includes the object Instruction. |
instruction.refunded | This event occurs when the beneficiary bank rejects the instruction, includes the object instruction. |
Errors
The GameCash API uses the following error codes:
Error | Description |
---|---|
400 | Bad Request -- The JSON message sent in the request body is invalid. |
401 | Unauthorized -- The Entered API Key is incorrect |
404 | Not Found -- The resource doesn't exist |
422 | Unprocessable Entity -- Error in the parameter validation. |
500 | Internal Server Error -- We encountered an error, please try again later |
Institutions Catalog
Code | Name |
---|---|
2001 | BANXICO |
37006 | BANCOMEXT |
37009 | BANOBRAS |
37019 | BANJERCITO |
37135 | NAFIN |
37166 | BANSEFI |
37168 | HIPOTECARIA FED |
40002 | BANAMEX |
40012 | BBVA BANCOMER |
40014 | SANTANDER |
40021 | HSBC |
40030 | BAJIO |
40036 | INBURSA |
40042 | MIFEL |
40044 | SCOTIABANK |
40058 | BANREGIO |
40059 | INVEX |
40060 | BANSI |
40062 | AFIRME |
40072 | BANORTE |
40102 | ACCENDO BANCO |
40103 | AMERICAN EXPRES |
40106 | BANK OF AMERICA |
40108 | MUFG |
40110 | JP MORGAN |
40112 | BMONEX |
40113 | VE POR MAS |
40124 | DEUTSCHE |
40126 | CREDIT SUISSE |
40127 | AZTECA |
40128 | AUTOFIN |
40129 | BARCLAYS |
40130 | COMPARTAMOS |
40132 | MULTIVA BANCO |
40133 | ACTINVER |
40136 | INTERCAM BANCO |
40137 | BANCOPPEL |
40138 | ABC CAPITAL |
40140 | CONSUBANCO |
40141 | VOLKSWAGEN |
40143 | CIBANCO |
40145 | BBASE |
40147 | BANKAOOL |
40148 | PAGATODO |
40150 | INMOBILIARIO |
40151 | DONDE |
40152 | BANCREA |
40154 | BANCO FINTERRA |
40155 | ICBC |
40156 | SABADELL |
40157 | SHINHAN |
40158 | MIZUHO BANK |
40160 | BANCO S3 |
90600 | MONEXCB |
90601 | GBM |
90602 | MASARI |
90605 | VALUE |
90606 | ESTRUCTURADORES |
90608 | VECTOR |
90613 | MULTIVA CBOLSA |
90616 | FINAMEX |
90617 | VALMEX |
90620 | PROFUTURO |
90630 | CB INTERCAM |
90631 | CI BOLSA |
90634 | FINCOMUN |
90636 | HDI SEGUROS |
90638 | AKALA |
90642 | REFORMA |
90646 | STP |
90648 | EVERCORE |
90652 | CREDICAPITAL |
90653 | KUSPIT |
90656 | UNAGRA |
90659 | ASP INTEGRA OPC |
90670 | LIBERTAD |
90677 | CAJA POP MEXICA |
90680 | CRISTOBAL COLON |
90683 | CAJA TELEFONIST |
90684 | TRANSFER |
90685 | FONDO (FIRA) |
90686 | INVERCAP |
90689 | FOMPED |
90901 | CLS |
90902 | INDEVAL |
90903 | CoDi Valida |
91812 | BBVA BANCOMER2 |
90814 | SANTANDER2 |
91821 | HSBC2 |