Crear Invoice
Changed onCrea una Invoice o actualiza la existente si coincide el identificador.
Es la forma de cargar una Invoice a un Customer. Toda Invoice queda asociada a una Subscription: puedes indicarla por su identificador público si ya existe, o enviar un product_id y dejar que Toku resuelva la Subscription a partir de él. Es idempotente por su identificador de negocio (product_id más due_date o invoice_external_id): si la Invoice ya existe se actualiza y la respuesta es 200; si es nueva se crea y la respuesta es 201. El monto va en la moneda de la Invoice, con los decimales que esa moneda admita.
Límite de tasa: 20 solicitudes por segundo. Al superarlo, la API responde 429. Ver Límites de tasa.
Request
- Base URLhttps://api.trytoku.com
- URLhttps://api.trytoku.com/invoices
- AuthAPI key in header x-api-key
Headers
Llave de API de una Account, para operar sobre esa Account en lugar de la principal.
Versión del API para esta petición, como cualquier fecha YYYY-MM-DD. Fija el contrato de la respuesta; si se omite, se deriva de la fecha de creación de la organización.
Request body
Example request
{
"amount": 19990,
"customer": "cus_ejC08yLqOWoFhVx4Fx42E3IR9X50tNx2",
"due_date": "2025-03-10",
"expiration_date": "2025-03-10 00:00:00",
"invoice_external_id": "F-2025-000123",
"link_payment": "https://portal.pagos.com/tu-empresa",
"metadata": {
"sucursal": "Providencia"
},
"product_id": "plan-oro-marzo-2025",
"subscription": "sub_Y_EgOXMloD5-IJn6d9S2IxkNvp9p0iiP"
}Response
Invoice actualizada (ya existía una con el mismo identificador).
Example response
{
"account": "acc_gzD0XoUTFxbUFcItpWOCqN686noSd9HQ",
"amount": 19990,
"customer": "cus_ejC08yLqOWoFhVx4Fx42E3IR9X50tNx2",
"due_date": "2025-03-10",
"expiration_date": "2025-03-10T03:00:00Z",
"id": "in_9K0bTq3xR7yA2sVpLmZ4wE1nHdJf6UcQ",
"invoice_external_id": "F-2025-000123",
"link_payment": "https://portal.pagos.com/tu-empresa",
"max_collection_attempts": 3,
"metadata": {
"sucursal": "Providencia"
},
"product_id": "plan-oro-marzo-2025",
"receipt_type": "bill",
"remaining_collection_attempts": 3,
"source": "integration_etl",
"subscription": "sub_Y_EgOXMloD5-IJn6d9S2IxkNvp9p0iiP"
}Changes
- breaking
request body became required
- breaking
for the
headerrequest parameterx-account-key, default valuewas added - breaking
added to the
request propertyallOflist - breaking
added to the
request propertyallOflist - breaking
removed the enum value
DELETEof the request property - breaking
removed the enum value
VOIDof the request property - breaking
request property
list-of-types was narrowed by removing typesnumberfrom media typeapplication/json - breaking
added the pattern
^((https://)|(http://))[a-zA-Z0-9.\-_~+#,%&=*;:@!/()?_{}\[\]|~]+$to the request propertylink_payment - breaking
added the pattern
^(?:[^ \n](?:[^\n]*[^ \n])?)?$to the request property - breaking
added the pattern
^\S+$to the request property - breaking
the
request property type changed fromstringto no type - breaking
the
request property type changed fromstringto no type - breaking
the
request property type changed fromstringtointeger - breaking
the
request property type changed fromstringtoobject, and format fromjsonto no format - breaking
the
request property type changed fromstringto no type - breaking
the
response's property type changed fromintegertonumberfor status - breaking
the
response's property type changed fromintegertonumberfor status - breaking
the
response's property type changed fromstringto no type for status - breaking
the
response's property type changed fromstringto no type for status - breaking
the
response's property type changed from no type tointegerfor status - breaking
the
response's property type changed from no type tointegerfor status - breaking
the
response's property type changed from no type tostringfor status - breaking
the
response's property type changed from no type tostringfor status - breaking
the
response's property type changed from no type tostringfor status - breaking
the
response's property type changed from no type tostringfor status - breaking
the
response's property type changed fromstringto no type for status - warning
the
request property's exclusiveMaximum was set to1000000000000000.00 - warning
the
request property's maxLength was set to256 - warning
the
request property's maxLength was set to256 - warning
the
request property's maxLength was set to256 - warning
the
request property's min was set to0.00 - warning
removed the optional property
from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - warning
removed the optional property
/from the response with the status - info
api operation id
crear-invoiceremoved and replaced withcreate_or_update_invoice - info
api tag
Invoicesadded - info
added the new optional
headerrequest parameterx-api-version - info
added the new optional request property
- info
added
subschema #2to therequest propertyanyOflist - info
the request property
became optional - info
the
request property default value{}was added - info
the
request property format was generalized fromfloatto no format - info
the
request property format was generalized fromdateto no format - info
the
request property format was generalized fromdate-timeto no format - info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the non-success response with the status
- info
removed the non-success response with the status
- info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added the optional property
to the response with the status - info
added to the
response propertyallOflist for the response status - info
added to the
response propertyallOflist for the response status - info
added to the
response propertyallOflist for the response status - info
the response property
became required for the status - info
the response property
became required for the status - info
the response property
became required for the status - info
the response property
became required for the status - info
the response property
became required for the status - info
the response property
/became required for the status - info
the response property
/became required for the status - info
the response property
became required for the status - info
the response property
became required for the status - info
the response property
became required for the status - info
the response property
became required for the status - info
the response property
became required for the status - info
the response property
became required for the status - info
the response property
became required for the status - info
the
response's property default value changed fromtruetofalsefor the status - info
the
response's property default value changed fromtruetofalsefor the status - info
the
response's property default value changed fromtruetofalsefor the status - info
the
response's property default value changed fromtruetofalsefor the status - info
the
response's property default value changed fromtruetofalsefor the status - info
the
response's property default value changed fromtruetofalsefor the status - info
the
response's property default value0was removed for the status - info
the
response's property default value0was removed for the status - info
added the required property
to the response with the status - info
added the required property
to the response with the status - info
added the required property
to the response with the status
- breaking