Crear Subscription
Changed onCrea una Subscription o actualiza la existente si coincide el identificador.
Se usa para dar de alta el cobro de un producto a un Customer. Es idempotente por (Account, product_id): si ya existe una Subscription con ese product_id, se actualiza y la respuesta es 200; si es nueva, se crea y la respuesta es 201. Para un cobro recurrente envía is_recurring=true junto con la configuración de recurrencia (frecuencia, intervalo, monto, día de vencimiento).
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/subscriptions
- 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_day": 5,
"interval": 1,
"is_recurring": true,
"product_id": "plan-oro-2025"
}Response
La Subscription ya existía y fue actualizada.
Example response
{
"customer": "cus_ejC08yLqOWoFhVx4Fx42E3IR9X50tNx2",
"id": "sub_Y_EgOXMloD5-IJn6d9S2IxkNvp9p0iiP",
"id_account": "acc_gzD0XoUTFxbUFcItpWOCqN686noSd9HQ"
}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
dailyof the request property - breaking
removed the enum value
monthlyof the request property - breaking
removed the enum value
weeklyof the request property - breaking
removed the enum value
yearlyof the request property - breaking
the
request property's minLength was increased from0to1 - breaking
the
request property type changed fromstringto no type - breaking
the
request property type changed fromstringto no type - breaking
the
request property type changed fromstringtoobject, and format fromjsonto no format - breaking
the response's body type changed from no type to
objectfor status - breaking
the
response's property type changed fromintegertonumberfor status - breaking
the
response's property type changed fromintegertonumberfor status - warning
the
request property's exclusiveMaximum was set to1000000000000000.00 - warning
the
request property's maxLength was set to8 - warning
the
request property's max was set to31.00 - warning
the
request property's max was set to52.00 - warning
the
request property's min was set to0.00 - warning
the
request property's min was set to0.00 - warning
the
request property's min was set to1.00 - warning
the
request property's min was set to1.00 - warning
the
request property's min was set to1.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 - info
api operation id
crear-subscriptionremoved and replaced withcreate_or_update_subscription - info
api tag
Subscriptionsadded - info
added the new optional
headerrequest parameterx-api-version - info
the
request property format was generalized fromfloatto no format - info
the
request property format was generalized fromint32to no format - info
removed
subschema #1subschema #2: Exception - due_dayfrom the response bodyoneOflist for the response 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
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 value0was removed for 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
the
response's property default value0was removed for the status - info
the
response's property pattern^(?:[^ \n](?:[^\n]*[^ \n])?)?$was added for the status - info
the
response's property pattern^(?:[^ \n](?:[^\n]*[^ \n])?)?$was added 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 - 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 - info
added the required property
to the response with the status
- breaking