Pagos

Listar pagos, agrupados por forma de pago. Crear pagos a documentos. Pagos de crédito cliente, cheques.

Estructura JSON

Al realizar una petición HTTP, el servicio retornara un JSON con la siguiente estructura:

{

"href": "https://api.bsale.com.pe/v1/payments/950.json",

"id": 950,

"recordDate": 1396494000,

"amount": "68643.0",

"checkDate": null,

"checkNumber": null,

"checkAmount": "0",

"state": 0,

"payment_type": {

"href": "https://api.bsale.com.pe/v1/payment_types/1.json",

"id": "1"

},

"document": {

"href": "https://api.bsale.com.pe/v1/documents/3285.json",

"id": "3285"

},

"office": {

"href": "https://api.bsale.com.pe/v1/offices/2.json",

"id": "2"

},

"user": {

"href": "https://api.bsale.com.pe/v1/users/7.json",

"id": "7"

}

}

  • href, url de un pago (String).

  • id, identificador único del pago (Integer).

  • recordDate, fecha en que se realizo el pago (Integer).

  • amount, monto del pago (Float).

  • checkDate, fecha del cheque (Integer).

  • checkNumber, numero del cheque (Integer).

  • checkAmount, monto del cheque (Float).

  • state, boolean (0 o 1) indica si el pago esta activos(0) inactivos(1).

  • payment_type, nodo que indica la forma de pago en la cual se realizo el pago.

  • document, nodo que indica a que documento se le realizo el pago.

  • office, nodo que indica la sucursal donde se realizo el pago.

  • user, nodo que indica el usuario que realizo el pago.

GET lista de pagos

  • GET /v1/payments.json retornara todos los pagos realizados.

####Parametros

  • limit, limita la cantidad de items de una respuesta JSON, por defecto el limit es 25, el máximo permitido es 50.

  • offset, permite paginar los items de una respuesta JSON, por defecto el offset es 0.

  • fields, solo devolver atributos específicos de un recurso

  • expand, permite expandir instancias y colecciones.

  • recorddate, Permite filtrar por fecha del pago.

  • documentid, Permite filtrar por el id del documento.

  • state, boolean (0 o 1) indica si los pagos están activos(0) inactivos(1).

####Ejemplos

  • GET /v1/payments.json?limit=10&offset=0

  • GET /v1/payments.json?recorddate=1393642800,

  • GET /v1/payments.json?documentid=856,

  • GET /v1/payments.json?expand=[office,payment_type]

####Respuesta

{

"href": "https://api.bsale.com.pe/v1/payments.json",

"count": 1926,

"limit": 4,

"offset": 0,

"items": [

{

"href": "https://api.bsale.com.pe/v1/payments/950.json",

"id": 950,

"recordDate": 1396494000,

"amount": "68643.0",

"checkDate": null,

"checkNumber": null,

"checkAmount": "0",

"state": 0,

"payment_type": {

"href": "https://api.bsale.com.pe/v1/payment_types/1.json",

"id": "1"

},

"document": {

"href": "https://api.bsale.com.pe/v1/documents/3285.json",

"id": "3285"

},

"office": {

"href": "https://api.bsale.com.pe/v1/offices/2.json",

"id": "2"

},

"user": {

"href": "https://api.bsale.com.pe/v1/users/7.json",

"id": "7"

}

},

{

"href": "https://api.bsale.com.pe/v1/payments/951.json",

"id": 951,

"recordDate": 1396494001,

"amount": "281494.0",

"checkDate": null,

"checkNumber": null,

"checkAmount": "0",

"state": 0,

"payment_type": {

"href": "https://api.bsale.com.pe/v1/payment_types/1.json",

"id": "1"

},

"document": {

"href": "https://api.bsale.com.pe/v1/documents/3286.json",

"id": "3286"

},

"office": {

"href": "https://api.bsale.com.pe/v1/offices/2.json",

"id": "2"

},

"user": {

"href": "https://api.bsale.com.pe/v1/users/7.json",

"id": "7"

}

},

{

"href": "https://api.bsale.com.pe/v1/payments/957.json",

"id": 957,

"recordDate": 1396494000,

"amount": "52637.0",

"checkDate": null,

"checkNumber": null,

"checkAmount": "0",

"state": 0,

"payment_type": {

"href": "https://api.bsale.com.pe/v1/payment_types/1.json",

"id": "1"

},

"document": {

"href": "https://api.bsale.com.pe/v1/documents/3287.json",

"id": "3287"

},

"office": {

"href": "https://api.bsale.com.pe/v1/offices/2.json",

"id": "2"

},

"user": {

"href": "https://api.bsale.com.pe/v1/users/8.json",

"id": "8"

}

},

{

"href": "https://api.bsale.com.pe/v1/payments/958.json",

"id": 958,

"recordDate": 1396494002,

"amount": "22837.0",

"checkDate": null,

"checkNumber": null,

"checkAmount": "0",

"state": 0,

"payment_type": {

"href": "https://api.bsale.com.pe/v1/payment_types/1.json",

"id": "1"

},

"document": {

"href": "https://api.bsale.com.pe/v1/documents/3288.json",

"id": "3288"

},

"office": {

"href": "https://api.bsale.com.pe/v1/offices/2.json",

"id": "2"

},

"user": {

"href": "https://api.bsale.com.pe/v1/users/8.json",

"id": "8"

}

}

]

}

GET un pago

  • GET /v1/payments/950.json retornara un pago específico.

####Respuesta

{

"href": "https://api.bsale.com.pe/v1/payments/950.json",

"id": 950,

"recordDate": 1396494000,

"amount": "68643.0",

"checkDate": null,

"checkNumber": null,

"checkAmount": "0",

"state": 0,

"payment_type": {

"href": "https://api.bsale.com.pe/v1/payment_types/1.json",

"id": "1"

},

"document": {

"href": "https://api.bsale.com.pe/v1/documents/3285.json",

"id": "3285"

},

"office": {

"href": "https://api.bsale.com.pe/v1/offices/2.json",

"id": "2"

},

"user": {

"href": "https://api.bsale.com.pe/v1/users/7.json",

"id": "7"

}

}

GET pagos agrupados por forma de pago

  • GET /v1/payments/group_payment_types.json retornara todos los pagos realizados.

####Parametros

  • limit, limita la cantidad de items de una respuesta JSON, si no se envía el limit es 25.

  • offset, permite paginar los items de una respuesta JSON, si no se envía el offset es 0.

  • fields, solo devolver atributos específicos de un recurso

  • expand, permite expandir instancias y colecciones.

  • recorddate, Permite filtrar por fecha del pago.

  • code, Código documento basado en los identificadores de la SUNAT, pueden ser varios separados por coma.

  • documentid, filtra por documento.

  • officeid, filtra por sucursal.

  • paymenttypeid, filtra por forma de pago.

####Ejemplos

  • GET /v1/payments/group_payment_types.json?limit=10&offset=0

  • GET /v1/payments/group_payment_types.json?recorddate=1393642800,

####Respuesta

[

{

"recordDate": 1396494000,

"paymentTypeTotalAmount": 40906.0,

"paymentTypeId": 1,

"paymentTypeName": "Efectivo",

"paymentLedgerAccount": null,

"isCheck": 0,

"isCreditNote": 0,

"isClientCredit": 0,

"isCash": 1,

"isCreditMemo": 0,

"code": "35",

"officeId": 1,

"officeName": "Puerto Varas",

"officeCostCenter": "",

"details": [


]

},

{

"recordDate": 1396494000,

"paymentTypeTotalAmount": 174592.0,

"paymentTypeId": 1,

"paymentTypeName": "Efectivo",

"paymentLedgerAccount": null,

"isCheck": 0,

"isCreditNote": 0,

"isClientCredit": 0,

"isCash": 1,

"isCreditMemo": 0,

"code": "39",

"officeId": 2,

"officeName": "Los Angeles",

"officeCostCenter": "",

"details": [


]

},

{

"recordDate": 1396494000,

"paymentTypeTotalAmount": 75204.0,

"paymentTypeId": 2,

"paymentTypeName": "Tarjeta de Crédito",

"paymentLedgerAccount": null,

"isCheck": 0,

"isCreditNote": 0,

"isClientCredit": 0,

"isCash": 0,

"isCreditMemo": 0,

"code": "35",

"officeId": 1,

"officeName": "Puerto Varas",

"officeCostCenter": "",

"details": [

{

"name": "Nº Comprobante",

"value": ""

}

]

},

{

"recordDate": 1396494000,

"paymentTypeTotalAmount": 54328.0,

"paymentTypeId": 2,

"paymentTypeName": "Tarjeta de Crédito",

"paymentLedgerAccount": null,

"isCheck": 0,

"isCreditNote": 0,

"isClientCredit": 0,

"isCash": 0,

"isCreditMemo": 0,

"code": "39",

"officeId": 2,

"officeName": "Los Angeles",

"officeCostCenter": "",

"details": [

{

"name": "Nº Comprobante",

"value": ""

}

]

},

{

"recordDate": 1396494000,

"paymentTypeTotalAmount": 816873.0,

"paymentTypeId": 4,

"paymentTypeName": "Crédito",

"paymentLedgerAccount": "",

"isCheck": 0,

"isCreditNote": 0,

"isClientCredit": 1,

"isCash": 0,

"isCreditMemo": 0,

"code": "33",

"officeId": 1,

"officeName": "Puerto Varas",

"officeCostCenter": "",

"details": [


]

},

{

"recordDate": 1396494000,

"paymentTypeTotalAmount": 16373.0,

"paymentTypeId": 5,

"paymentTypeName": "Cheque",

"paymentLedgerAccount": "",

"isCheck": 1,

"isCreditNote": 0,

"isClientCredit": 0,

"isCash": 0,

"isCreditMemo": 0,

"code": "39",

"officeId": 2,

"officeName": "Los Angeles",

"officeCostCenter": "",

"details": [

{

"name": "Banco",

"value": ""

},

{

"name": "Número",

"value": ""

}

]

},

{

"recordDate": 1396494000,

"paymentTypeTotalAmount": 32658.0,

"paymentTypeId": 6,

"paymentTypeName": "Tarjeta de Débito",

"paymentLedgerAccount": "",

"isCheck": 0,

"isCreditNote": 0,

"isClientCredit": 0,

"isCash": 0,

"isCreditMemo": 0,

"code": "39",

"officeId": 2,

"officeName": "Los Angeles",

"officeCostCenter": "",

"details": [

{

"name": "N Operacion",

"value": ""

}

]

}

]

GET cantidad de pagos

  • GET /v1/payments/count.json

####Parametros

  • state, permite filtrar por estado, activos (0) inactivos (1).

####Respuesta

{

"count": 1926

}

POST un Pago

  • POST /v1/payments.json

Se debe enviar un Json con la siguiente estructura.

{

"recordDate": 1436214454,

"amount": 3791,

"documentId": 3004,

"paymentTypeId": 11

}

Atributos dinámicos (opcional)

En el caso de necesitar agregar atributos adicionales al pago, se necesita agregar un nodo similar a:

"dynamicAttributes": [

{

"description": "comprobante 123456",

"dynamicAttributeId": 1

}

]

####Respuesta

{

"href": "https://api.bsale.com.pe/v1/payments/4873.json",

"id": 4873,

"recordDate": 1436214454,

"amount": 3791,

"checkDate": null,

"checkNumber": null,

"checkAmount": null,

"checkTaken": 0,

"state": 0,

"payment_type": {

"href": "https://api.bsale.com.pe/v1/payment_types/11.json",

"id": "11"

},

"document": {

"href": "https://api.bsale.com.pe/v1/documents/3004.json",

"id": "3004"

},

"office": {

"href": "https://api.bsale.com.pe/v1/offices/2.json",

"id": "2"

},

"user": {

"href": "https://api.bsale.com.pe/v1/users/2.json",

"id": "2"

}

}