Order Authorization¶
Authorize an Order¶
Autoriza un pedido.
Resource URL¶
-
POST
http://api.next-cloud.mx/v1/payment/
(int: order_id).
(format)¶ Parameters: - order_id – Número de pedido.
- format – json o xml.
Request Headers: - Authorization – Token del usuario.
- Content-Type – Define el formato en el que se envian los datos por el body.
Request JSON Object: - bank_id (int) – ID del banco.
- account_number (string) – Número de la tarjeta de crédito.
- account_holder (string) – Nombre del propietario como aparece en la tarjeta de crédito.
- due_date (string) – Fecha de vencimiento.
- payment_method (string) – Tipo de documento de pago. Consulte con su contacto administrativo para obtenerlo.
- data_gateway (obj) – Datos de la pasarela
- third_parties (obj) – Cargos a terceros
- credit_balances (list) – Lista de saldos a favor
- token (string) – (opcional) Token de la tarjeta de crédito.
- device_session_id (string) – (opcional) ID del dispositivo.
- ip (string) – (opcional) IP del dispositivo.
- cookie (string) – (opcional) Cookie.
- user_agent (string) – (opcional) Datos del navegador Web.
Response JSON Object: - orden (obj) – Datos del pedido.
- authorization (obj) – Datos de la autorización.
Status Codes: - 200 OK – Ningún error.
- 400 Bad Request – Algún parámetro es incorrecto.
- 401 Unauthorized – Token no válido o no enviado.
- 404 Not Found – el cliente no existe.
data_gateway object:
Request JSON Object: - payment_method (string) – metodo de pago
- number_payments (int) – numero de pagos
- response_url (string) – url de respuesta
- user_type (string) – tipo de usuario
- terminal (int) – numero de terminal
- financial_institution_code (string) – numero de institucion financiera
- card (int) – tarjeta
- pse_reference2 – referencia 2
- pse_reference3 – referencia 3
third_parties object:
Request JSON Object: - freight_payments (int) – numero de pagos de flete
- authorize_freight (string) – numero de autorisacion de flete
- operator (int) – numero de operador
- freight (int) – flete
- items (array) – lista de objetos de item
item object:
Request JSON Object: - payments (string) – pagos
- sku (string) – sku del articulo
- down_payment (string) – enchange del articulo
- authorizes (string) – numero de autorisacion
- amount (float) – cantidad de articulos
Example request¶
POST v1/payment/123.json HTTP/1.1
Host: api.next-cloud.mx
Accept: application/json
Content-Type: application/json
Authorization: Token ( token del usuario )
{
"credit_balances": [
2534766,
2534767
],
"payment_method": "PPAYU",
"payment_gateway": {
"payment_method": "EFECTY",
"number_payments": 1,
"response_url": "",
"user_type": "",
"terminal": 3,
"financial_institution_code": "",
"card": 1,
"pse_reference2": "",
"pse_reference3": ""
},
"device_session_id": "",
"user_agent": "",
"due_date": "0909",
"ip": "",
"account_number": 4111111111111111123,
"bank_id": 38,
"cookie": "",
"account_holder": "algun nombre",
"third_parties": {
"items": [
{
"payments": 1,
"sku": 2420084,
"down_payment": 1,
"authorizes": 13244,
"amount": 1
}
],
"freight_payments": 1,
"authorize_freight": 13244,
"operator": 4,
"freight": 1
},
"token": ""
}
Example Response¶
HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/json
Allow: POST, OPTIONS
{
"detail":"Saldo a Favor."
}
Example XML¶
Example request¶
POST v1/payment/123.xml HTTP/1.1
Host: api.next-cloud.mx
Accept: application/xml
Content-Type: application/xml
Authorization: Token ( token del usuario )
<?xml version="1.0" encoding="UTF-8"?>
<root>
<due_date>0909</due_date>
<device_session_id />
<payment_method>PPAYU</payment_method>
<ip />
<account_number>4111111111111111123</account_number>
<bank_id>38</bank_id>
<credit_balances>
<list-item>2534766</list-item>
<list-item>2534767</list-item>
</credit_balances>
<token />
<cookie />
<user_agent />
<account_holder>algun nombre</account_holder>
<third_parties>
<operator>4</operator>
<items>
<list-item>
<sku>2420084</sku>
<amount>1</amount>
<authorizes>13244</authorizes>
<down_payment>1</down_payment>
<payments>1</payments>
</list-item>
</items>
<authorize_freight>13244</authorize_freight>
<freight>1</freight>
<freight_payments>1</freight_payments>
</third_parties>
<payment_gateway>
<financial_institution_code />
<response_url />
<payment_method>EFECTY</payment_method>
<number_payments>1</number_payments>
<user_type />
<terminal>3</terminal>
<pse_reference2 />
<pse_reference3 />
<card>1</card>
</payment_gateway>
</root>
Example Response¶
HTTP/1.1 200 OK
Vary: Accept
Content-Type: application/xml; charset=utf-8
Allow: POST, OPTIONS
<?xml version="1.0" encoding="UTF-8"?>
<root>
<detail>Saldo a Favor.</detail>
</root>