Actualizar suscripción en Recharge, con una API

Cambia una suscripción activa y la devuelve. Cambiar order_interval_unit, order_interval_frequency o charge_interval_frequency exige los tres, recalcula la fecha del próximo cargo y elimina los cargos omitidos y los cambiados manualmente. Para mover solo el próximo cargo, usa Set subscription next charge date.

Identificador
recharge_update_subscription

La llamada

POST https://connect.reportei.com/api/tools/recharge_update_subscription/execute
Authorization: Bearer <merchant token>
x-customer-token: <customer token>
Content-Type: application/json
Accept: application/json

{
  "customer_toolkit": "<connection UUID>",
  "arguments": {
    "id": 1
  }
}

Tu sistema envía el id de la conexión de tu cliente y los argumentos de la tool. Los headers son los mismos de toda la API de Connect: el token de tu producto y el token de tu cliente.

Parámetros

Las descripciones de los parámetros siguen la documentación oficial de la app, en inglés.

ParámetroTipoObligatorioDescripción
idintegerSíId of a subscription from List subscriptions.
quantityintegerNoNumber of units in each order.
pricestringNoPrice of one unit before discounts, taxes and shipping, such as 10.00.
external_variant_idobjectNoNew product variant in the store platform, to swap the product. The variant id comes from external_variant_id of a subscription in List subscriptions, or from the product page in the store admin.
use_external_variant_defaultsbooleanNoWith a new external_variant_id, takes the price from that variant.
product_titlestringNoName of the product.
variant_titlestringNoName of the product variant.
skustringNoSKU used for the charges and orders of this subscription in place of the SKU of the variant.
order_interval_unitstringNoUnit of the order and charge frequencies. Send it with order_interval_frequency and charge_interval_frequency.Valores: day, week, month
order_interval_frequencyintegerNoNumber of order_interval_unit between orders.
charge_interval_frequencyintegerNoNumber of order_interval_unit between charges.
order_day_of_monthintegerNoDay of the month the orders are created on. Removes skipped and manually changed charges.
order_day_of_weekintegerNoDay of the week the orders are created on. Removes skipped and manually changed charges.
expire_after_specific_number_of_chargesintegerNoNumber of charges after which the subscription expires.
propertiesarrayNoLine item properties of the subscription, such as a color or an engraving text. The list replaces the current one.
commitbooleanNoTrue waits until the queued charges of the subscription are regenerated before answering. The default is false, which regenerates them a few seconds later.
force_updatebooleanNoTrue also applies the change to a cancelled subscription.

Conexiones posibles

Tu cliente conecta su cuenta de Recharge una sola vez, con uno de los modos de abajo. La misma conexión sirve para todas las tools del toolkit.

Clave de API

Tu cliente pega la clave de la app en una pantalla de Connect, o tu sistema envía la clave con POST /api/customer-toolkits, sin pantalla.

La respuesta

Si la llamada tiene éxito, Connect conserva el status y el cuerpo de la respuesta de la app. Los errores HTTP devueltos por la app usan el objeto {error, api_error}; la autenticación o validación pueden fallar antes de la ejecución. El header X-Toolkit-Execution-Id identifica la ejecución registrada, disponible en GET /api/tools/executions/{uuid}.

Lista para agentes de IA

El input de esta tool es un JSON Schema, disponible en GET /api/tools/recharge_update_subscription. Se convierte en la definición de tool de tu agente sin conversión.

Otras tools de Recharge

Ver las 12 tools

Toolkits de la misma categoría

Ver los 100 toolkits

Mira Connect aplicado a tu producto.

Pruébalo durante 15 días sin tarjeta, o cuéntale tu caso a nuestro equipo.