API de facturas
Ver en POSTMAN
Recurso para obtener las facturas generadas en Increase Pay o generar facturas nuevas para pagos unicos
Cómo probar
Recuerda usar la Base URL de Sandbox para hacer pruebas:
https://gateway.increase.app/pay-sandbox/public/v1/
URL Producción: https://gateway.increase.app/pay/public/v1/
Estados de una factura
Estado | Descripción |
---|---|
open | Abierta: la factura se ha creado. En caso de tener un pago asociado, el mismo aún no se ha cobrado exitosamente. Si no tiene un método de pago válido asociado, no puede salir de éste estado. |
paid | Pagada: se ha confirmado un cobro exitoso. |
canceled | Cancelada: la factura se ha cancelado y no generará más cobros. Se puede cancelar únicamente las facturas open y retries_pending que no tengan pagos en proceso. |
uncollectible | Incobrable: factura con un único pago rechazado o todos los pagos rechazados de acuerdo a la lógica de reintentos configurada. |
retries_pending | Reintentos en proceso: El método de cobro (collect method) debe tener configurado reintents para que una factura llegue a este estado. Al este estado se llega si la factura tiene su primer pago rechazado y hay reintentos disponibles corriendo. |
refunded | Reintegro: la factura previamente pagada fue devuelta al cliente a través de una Nota de Crédito. |
refund_in_process | Reintegro en proceso: devolución en proceso de una factura previamente pagada. |
Crear una factura
POST https://gateway.increase.app/pay/public/v1/invoices
Parámetro | Tipo | Descripción | Requerido |
---|---|---|---|
customer_id | String | id del cliente asociado | si |
collect_methods | Object | Objeto de configuración de medios de pago que seran ofrecidos al cliente | si |
items | String | Conceptos a facturar | si |
currency | String | Moneda en formato ISO 4217. Ej: ARS | si |
amount | String | Monto total de la factura | si |
success_url | String | URl de exito (https://www.tuempresa.com/gracias) | no |
external_id | String | Identificador de la factura en tu sistema | no |
payment_method_id | String | Método de pago del cliente | no |
⚠️ DEPRECATION WARNING (31-03-2021): el parametro
external_reference
pasa a llamarseexternal_id
. Si bien sigue siendo posible utilizarexternal_reference
por el momento, este nombre no será valido a partir del 01-07-2021.
Dentro de Items podrás enviar los siguientes campos
Parámetro | Tipo | Descripción | Requerido |
---|---|---|---|
currency | String | Moneda en formato ISO 4217. Ej: ARS | si |
quantity | Number | Cantidad | si |
description | String | Producto o Servicio a Facturar | si |
unit_price | String | Monto unitario | si |
amount | String | Monto total del item (quantity x unit price) | si |
En caso de enviar el payment_method_id vacio la factura otorgará luego de crearse un "checkout_link" desde donde el usuario final podrá cargar el medio de pago.
Si la invoice fue creada con success_url
al momento del cliente realizar el pago será redirigido al sitio cargado. Enviaremos también los parametros customer_id
, invoice_id
y payment_method_id
Collect methods
El objeto collect_methods
admite solo un id por payment_category (card, cbu o ticket).
{
"card": [{"id": "..."}],
"cbu": [{"id": "..."}],
"ticket": []
}
Ejemplo
- Request body
- Response
{
"customer_id":"e9af012e-23a6-4b96-9918-2307ffb3aaa6",
"amount": "600.0",
"external_id": "ID de mi sitio",
"currency": "ARS",
"success_url": "https://increase.app/gracias",
"items": [
{
"currency": "ARS",
"quantity": 3,
"description": "Linea 1",
"unit_price": "50.0",
"amount": "150.0"
},
{
"currency": "ARS",
"description": "test",
"quantity": 1,
"unit_price": "450.0",
"amount": "450.0"
}
],
"collect_methods": {
"card": [
{
"id": "7936a685-9eaa-4b33-be44-df4240c17412"
}
],
"cbu": [
{
"id": "2ae4e61c-0382-4c67-86d0-85fd205823b3"
}
],
"ticket": []
}
}
{
"id": "2b4f5310-4be1-4e39-b596-de5676c41705",
"status": "open",
"amount": "100.0",
"external_id": "ID de mi sitio",
"customer": {
"id": "00000000-0000-0000-0000-000000000001",
"external_id": null,
"email": "7brenton_keeling@farrell.name",
"language": "ES",
"timezone": "Buenos Aires",
"first_name": null,
"last_name": null,
"billing_info": {},
"created_at": "2020-03-27T17:23:10-03:00"
},
"payments": [
{
"id": "da23e4a3-90b1-4edb-83ed-fa7053bdb74f",
"status": "open",
"amount": "100.0",
"currency": "ARS",
"payment_method": {
"id": "00000000-0000-0000-0000-000000000001",
"external_id": null,
"data": {
"type": "cbu",
"country": "ARG",
"number": "19101134**4200"
},
"created_at": "2020-03-27T17:23:10-03:00"
},
"events": [],
"created_at": "2020-03-27T17:23:10-03:00",
"rejection_code": null,
"rejection_type": null,
"rejection_description": null,
"paid_at": null
}
],
"currency": "ARS",
"created_at": "2020-03-27T17:23:10-03:00",
"paid_at": null,
"checkout_link": "http://localhost:3000/checkout/bac25f0c-db78-4e38-a951-a255e6a2976a?customer_id=00000000-0000-0000-0000-000000000001&invoice_id=2b4f5310-4be1-4e39-b596-de5676c41705&hash_value=MG4wRVBML3dBeHlHdXBZOHlkTzErbWxKQkdJeWF5RUdvNkx5UWJlNEsvRHdJU0QvTjJzOU9sY1ZiSFN2L25jVWJKM200MGcrVUJqSWRxMUM4N0ZMbTBwdzFrQ3ZLWmdCeSsvUCs4ZFYzaVA4K2JUSDgwZ3o5dGU3NSs4eWJiSnJ1bXl6eEkvK3NNbmdSQT09LS15cXdqNUd5TWxYUWhRT3ZXLS1OZjFXeXRjYW5Rcm1USUJjbnpsdElRPT0=",
"success_url": "https://increase.app/gracias",
"items": [
{
"id": "438be5ee-33ee-44e1-ac39-f3c3874c108f",
"description": "test",
"quantity": 1,
"unit_price": "50.0",
"amount": "50.0",
"currency": "ARS",
"item_number": 0,
"invoiceable_id": null,
"invoiceable_type": null,
"product_name": null
},
{
"id": "35af8dbe-a5b5-42dd-a9f4-49161851a036",
"description": "maiores voluptas",
"quantity": 50,
"unit_price": "50.0",
"amount": "50.0",
"currency": "ARS",
"item_number": 0,
"invoiceable_id": null,
"invoiceable_type": null,
"product_name": null
}
]
}
Obtener todas las facturas
GET
https://gateway.increase.app/pay/public/v1/invoices
Response
{
"data": [
{
"id": "62a0ef32-91cf-400b-ba85-05fdae8ac0a1",
"status": "open",
"amount": "15.0",
"customer": {
"id": "e9af012e-23a6-4b96-9918-2307ffb3aaa6",
"email": "mailcliente@gmail.com",
"first_name": "Juan",
"last_name": "Perez"
},
"payments": [],
"subscriptions": [
{
"id": "a739c9c9-b0ff-4102-a6da-eded25cde828",
"plan": {
"id": "57b7a2bb-ce27-47fb-88c8-e856f27e30d7",
"name": "Test_Automatico_Plan"
},
"customer": {
"id": "e9af012e-23a6-4b96-9918-2307ffb3aaa6",
"email": "mailcliente@gmail.com",
"first_name": "Juan",
"last_name": "Perez"
},
"quantity": 1,
"amount": "15.0",
"net_amount": "15.0",
"currency": "ARS",
"status": "pending",
"canceled_at": null,
"paused_at": null,
"trial_period_end": "2020-03-03T16:18:39-03:00",
"next_billing_date": "2020-06-03T16:18:39-03:00",
"created_at": "2020-03-03T16:18:39-03:00",
"product": {
"id": "9c1e30d8-04c4-4fae-b486-0ddeda8dea30",
"name": "Test_Automatico"
},
"activate_at": null,
"cancel_at": null
}
],
"currency": "ARS",
"created_at": "2020-03-03T16:18:39-03:00",
"paid_at": null,
"checkout_link": "https://pay.increase.app/invoice/8898b790-b8f4-44d0-b2db-10c4a881da63?invoice_id=62a0ef32-91cf-400b-ba85-05fdae8ac0a1",
"success_url": "https://increase.app/gracias"
}
],
"current_page": 1,
"per_page": 20,
"total_pages": 7,
"total_elements": 124
}
Obtener todas las facturas de un cliente específico
GET
https://gateway.increase.app/pay/public/v1/invoices?page=1&per_page=12?customer_id=<customer_id>
Obtener todas las facturas por external_id
GET
https://gateway.increase.app/pay/public/v1/invoices?page=1&per_page=12?external_id=<external_id>
Obtener una factura específica
GET https://gateway.increase.app/pay/public/v1/invoices/<id>
Response
{
"id": "62a0ef32-91cf-400b-ba85-05fdae8ac0a1",
"status": "open",
"amount": "15.0",
"customer": {
"id": "e9af012e-23a6-4b96-9918-2307ffb3aaa6",
"external_id": null,
"email": "clienteprueba@ejemplo.com",
"language": "ES",
"timezone": "Buenos Aires",
"first_name": "Juan",
"last_name": "Perez",
"billing_info": {
"id": "9e8aea0b-87d2-453e-9eb6-b74960d5f35d",
"address_line_1": "Hidalgo 142",
"address_line_2": "",
"country": "ARG",
"city": "caba",
"state": "caba",
"zip_code": "1405",
"phone": "1551125155",
"tax_id": "203720423123"
},
"created_at": "2020-03-03T16:18:09-03:00"
},
"payments": [],
"subscriptions": [
{
"id": "a739c9c9-b0ff-4102-a6da-eded25cde828",
"plan": {
"id": "57b7a2bb-ce27-47fb-88c8-e856f27e30d7",
"name": "Test_Automatico_Plan"
},
"customer": {
"id": "e9af012e-23a6-4b96-9918-2307ffb3aaa6",
"email": "clienteprueba@ejemplo.com",
"first_name": "Juan",
"last_name": "Perez"
},
"quantity": 1,
"amount": "15.0",
"net_amount": "15.0",
"currency": "ARS",
"status": "pending",
"canceled_at": null,
"paused_at": null,
"trial_period_end": "2020-03-03T16:18:39-03:00",
"next_billing_date": "2020-06-03T16:18:39-03:00",
"created_at": "2020-03-03T16:18:39-03:00",
"payment_method": null,
"product": {
"id": "9c1e30d8-04c4-4fae-b486-0ddeda8dea30",
"name": "Test_Automatico"
},
"external_id": null,
"activate_at": null,
"cancel_at": null,
"checkout_link": "https://pay.increase.app/checkout/8898b790-b8f4-44d0-b2db-10c4a881da63?subscription_id=a739c9c9-b0ff-4102-a6da-eded25cde828&hash_value=RnhNZHIzTlhaa0dJRGlmNkNRc3Vrd2FTdUFRTVRxSTVjRG9Ic1dTcmkrVnE2SXd5eDZza3lSVlgyTEtuRXZmcGExL0VzR01aUmdDVHE4eWhvVEU9LS03cDRBQUxaUXg4SlRXQnBtLS1NQmhRVXY3MkFkMlBqTHFad29GRDNBPT0="
}
],
"currency": "ARS",
"created_at": "2020-03-03T16:18:39-03:00",
"paid_at": null,
"checkout_link": "https://pay.increase.app/invoice/8898b790-b8f4-44d0-b2db-10c4a881da63?invoice_id=62a0ef32-91cf-400b-ba85-05fdae8ac0a1&hash_value=b0RtMzczNklaYkhUcmlzeTNjOXZ0N0RmUnFabzVVc0s4WVdadDRIbjF4eEhPeWduaVRRQnIyc1BrZkZEZTdsZyt3NlVRTHE0Z0ZuSi0tZEFTUmsyaURCeWJkaWdINS0tWFNTU2RITTF2TFBNMDBoVGQ4N1Vvdz09",
"items": [
{
"id": "37b200de-3f71-41d7-abcf-5846a7e674ca",
"description": "Test_Automatico_Plan",
"quantity": 1,
"unit_price": "15.0",
"amount": "15.0",
"currency": "ARS",
"item_number": 0,
"invoiceable_id": "a739c9c9-b0ff-4102-a6da-eded25cde828",
"invoiceable_type": "Subscription",
"product_name": "Test_Automatico"
}
]
}
Marcar como pagada una factura
POST
https://gateway.increase.app/pay/public/v1/invoices/<id>/manual_paid
Cancelar una factura
PATCH
https://gateway.increase.app/pay/public/v1/invoices/<id>/cancel