Atualizar assinatura no Recharge, por uma API

Altera uma assinatura ativa e a retorna. Mudar order_interval_unit, order_interval_frequency ou charge_interval_frequency exige os três, recalcula a data da próxima cobrança e remove cobranças puladas e alteradas manualmente. Para mover só a próxima cobrança, use Set subscription next charge date.

Identificador
recharge_update_subscription

A chamada

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
  }
}

Seu sistema envia o id da conexão do cliente e os argumentos da tool. Os headers são os mesmos de toda a API do Connect: o token do seu produto e o token do cliente.

Parâmetros

As descrições dos parâmetros seguem a documentação oficial do app, em inglês.

ParâmetroTipoObrigatórioDescrição
idintegerSimId of a subscription from List subscriptions.
quantityintegerNãoNumber of units in each order.
pricestringNãoPrice of one unit before discounts, taxes and shipping, such as 10.00.
external_variant_idobjectNãoNew 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_defaultsbooleanNãoWith a new external_variant_id, takes the price from that variant.
product_titlestringNãoName of the product.
variant_titlestringNãoName of the product variant.
skustringNãoSKU used for the charges and orders of this subscription in place of the SKU of the variant.
order_interval_unitstringNãoUnit of the order and charge frequencies. Send it with order_interval_frequency and charge_interval_frequency.Valores: day, week, month
order_interval_frequencyintegerNãoNumber of order_interval_unit between orders.
charge_interval_frequencyintegerNãoNumber of order_interval_unit between charges.
order_day_of_monthintegerNãoDay of the month the orders are created on. Removes skipped and manually changed charges.
order_day_of_weekintegerNãoDay of the week the orders are created on. Removes skipped and manually changed charges.
expire_after_specific_number_of_chargesintegerNãoNumber of charges after which the subscription expires.
propertiesarrayNãoLine item properties of the subscription, such as a color or an engraving text. The list replaces the current one.
commitbooleanNãoTrue waits until the queued charges of the subscription are regenerated before answering. The default is false, which regenerates them a few seconds later.
force_updatebooleanNãoTrue also applies the change to a cancelled subscription.

Conexões possíveis

O seu cliente conecta a conta do Recharge uma vez, por um dos modos abaixo. A mesma conexão serve para todas as tools do toolkit.

Chave de API

O cliente cola a chave do app numa tela do Connect, ou o seu sistema envia a chave por POST /api/customer-toolkits, sem tela.

A resposta

Em caso de sucesso, o Connect preserva o status e o corpo da resposta do app. Erros HTTP retornados pelo app usam o envelope {error, api_error}; falhas de autenticação ou validação podem ocorrer antes da execução. O header X-Toolkit-Execution-Id identifica a execução registrada, consultável em GET /api/tools/executions/{uuid}.

Pronta para agentes de IA

O input desta tool é um JSON Schema, disponível em GET /api/tools/recharge_update_subscription. Ele vira a definição de tool do seu agente sem conversão.

Outras tools do Recharge

Ver as 12 tools

Toolkits da mesma categoria

Ver os 100 toolkits

Veja o Connect aplicado ao seu produto.

Teste por 15 dias sem cartão, ou mostre seu cenário ao nosso time.