La documentación que estás leyendo no cuenta con los últimos cambios. ¡Revisa nuestra documentación actualizada!
Listar pagos, agrupados por forma de pago. Crear pagos a documentos. Pagos de crédito cliente, cheques.
Al realizar una petición HTTP, el servicio retornara un JSON con la siguiente estructura:
{ "href": "https://api.bsale.cl/v1/payments/81920.json", "id": 81920, "recordDate": "", "amount": 63027.0, "operationNumber": null, "accountingDate": "", "checkDate": null, "checkNumber": null, "checkAmount": null, "checkTaken": 0, "isCreditPayment":0, "createdAt": 1503948833, "state": 0, "payment_type": { "href": "https://api.bsale.cl/v1/payment_types/1.json", "id": "1" }, "office": { "href": "https://api.bsale.cl/v1/offices/2.json", "id": "2" }, "user": { "href": "https://api.bsale.cl/v1/users/34.json", "id": "34" }, "document": { "href": "https://api.bsale.cl/v1/documents/195.json", "id": "195" }}GET /v1/payments.json retornara todos los pagos realizados.Parametros
Ejemplos
GET /v1/payments.json?limit=10&offset=0GET /v1/payments.json?recorddate=1393642800,GET /v1/payments.json?documentid=856,GET /v1/payments.json?codesii=33&number=10,GET /v1/payments.json?expand=[office,payment_type]Respuesta
{ "href": "https://api.bsale.cl/v1/payments.json", "count": 155881, "limit": 3, "offset": 0, "items": [ { "href": "https://api.bsale.cl/v1/payments/79.json", "id": 79, "recordDate": 1548720000, "amount": 6000, "operationNumber": null, "accountingDate": "", "checkDate": null, "checkNumber": null, "checkAmount": null, "checkTaken": 0, "isCreditPayment": 0, "createdAt": 1548768524, "state": 0, "payment_type": { "href": "https://api.bsale.cl/v1/payment_types/4.json", "id": "4" }, "document": { "href": "https://api.bsale.cl/v1/documents/195.json", "id": "195" }, "office": { "href": "https://api.bsale.cl/v1/offices/1.json", "id": "1" }, "user": { "href": "https://api.bsale.cl/v1/users/1.json", "id": "1" } }, { "href": "https://api.bsale.cl/v1/payments/78.json", "id": 78, "recordDate": 1548720000, "amount": 29142, "operationNumber": null, "accountingDate": "", "checkDate": null, "checkNumber": null, "checkAmount": null, "checkTaken": 0, "isCreditPayment": 1, "createdAt": 1548768418, "state": 0, "payment_type": { "href": "https://api.bsale.cl/v1/payment_types/4.json", "id": "4" }, "documents": [ { "href": "https://api.bsale.cl/v1/documents/194.json", "id": "194", "amount": 2002 }, { "href": "https://api.bsale.cl/v1/documents/195.json", "id": "195", "amount": 6000 }, { "href": "https://api.bsale.cl/v1/documents/196.json", "id": "196", "amount": 21140 } ], "office": { "href": "https://api.bsale.cl/v1/offices/1.json", "id": "1" }, "user": { "href": "https://api.bsale.cl/v1/users/1.json", "id": "1" } } ], "next": "https://api.bsale.cl/v1/payments.json?limit=3\u0026offset=3"}GET /v1/payments/950.json retornara un pago específico.Respuesta
{ "href": "https://api.bsale.cl/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.cl/v1/payment_types/1.json", "id": "1" }, "document": { "href": "https://api.bsale.cl/v1/documents/3285.json", "id": "3285" }, "office": { "href": "https://api.bsale.cl/v1/offices/2.json", "id": "2" }, "user": { "href": "https://api.bsale.cl/v1/users/7.json", "id": "7" }}GET /v1/payments/group_payment_types.json retornara todos los pagos realizados.Parametros
Ejemplos
GET /v1/payments/group_payment_types.json?limit=10&offset=0GET /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, "codesii": "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, "codesii": "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, "codesii": "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, "codesii": "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, "codesii": "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, "codesii": "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, "codesii": "39", "officeId": 2, "officeName": "Los Angeles", "officeCostCenter": "", "details": [ { "name": "N Operacion", "value": "" } ] }]GET /v1/payments/count.jsonParametros
Respuesta
{ "count": 1926}POST /v1/payments.jsonSe 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.cl/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.cl/v1/payment_types/11.json", "id": "11" }, "document": { "href": "https://api.bsale.cl/v1/documents/3004.json", "id": "3004" }, "office": { "href": "https://api.bsale.cl/v1/offices/2.json", "id": "2" }, "user": { "href": "https://api.bsale.cl/v1/users/2.json", "id": "2" }}