Mettre à jour un abonnement avec l'API Recharge

Modifie un abonnement actif et le renvoie. Changer order_interval_unit, order_interval_frequency ou charge_interval_frequency exige les trois, recalcule la date du prochain prélèvement et supprime les prélèvements sautés et modifiés manuellement. Pour ne déplacer que le prochain prélèvement, utilisez Set subscription next charge date.

Identifiant
recharge_update_subscription

L'appel

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

Votre système envoie l'id de la connexion de votre client et les arguments de la tool. Les headers sont les mêmes que pour toute l'API Connect : le token de votre produit et celui de votre client.

Paramètres

Les descriptions des paramètres suivent la documentation officielle de l'app, en anglais.

ParamètreTypeObligatoireDescription
idintegerOuiId of a subscription from List subscriptions.
quantityintegerNonNumber of units in each order.
pricestringNonPrice of one unit before discounts, taxes and shipping, such as 10.00.
external_variant_idobjectNonNew 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_defaultsbooleanNonWith a new external_variant_id, takes the price from that variant.
product_titlestringNonName of the product.
variant_titlestringNonName of the product variant.
skustringNonSKU used for the charges and orders of this subscription in place of the SKU of the variant.
order_interval_unitstringNonUnit of the order and charge frequencies. Send it with order_interval_frequency and charge_interval_frequency.Valeurs : day, week, month
order_interval_frequencyintegerNonNumber of order_interval_unit between orders.
charge_interval_frequencyintegerNonNumber of order_interval_unit between charges.
order_day_of_monthintegerNonDay of the month the orders are created on. Removes skipped and manually changed charges.
order_day_of_weekintegerNonDay of the week the orders are created on. Removes skipped and manually changed charges.
expire_after_specific_number_of_chargesintegerNonNumber of charges after which the subscription expires.
propertiesarrayNonLine item properties of the subscription, such as a color or an engraving text. The list replaces the current one.
commitbooleanNonTrue waits until the queued charges of the subscription are regenerated before answering. The default is false, which regenerates them a few seconds later.
force_updatebooleanNonTrue also applies the change to a cancelled subscription.

Connexions possibles

Votre client connecte son compte Recharge une seule fois, avec l'un des modes ci-dessous. La même connexion sert à toutes les tools du toolkit.

Clé d'API

Votre client colle la clé de l'app sur un écran de Connect, ou votre système envoie la clé avec POST /api/customer-toolkits, sans écran.

La réponse

En cas de succès, Connect conserve le statut et le corps de la réponse de l'app. Les erreurs HTTP renvoyées par l'app utilisent l'objet {error, api_error} ; l'authentification ou la validation peuvent échouer avant l'exécution. Le header X-Toolkit-Execution-Id identifie l'exécution enregistrée, consultable avec GET /api/tools/executions/{uuid}.

Prête pour les agents IA

L'input de cette tool est un JSON Schema, disponible via GET /api/tools/recharge_update_subscription. Il devient la définition de tool de votre agent sans conversion.

Autres tools Recharge

Voir les 12 tools

Toolkits de la même catégorie

Voir les 100 toolkits

Voyez Connect appliqué à votre produit.

Essayez-le pendant 15 jours sans carte, ou présentez votre cas à notre équipe.