Mettre à jour un abonnement avec l'API Stripe

Met à jour un abonnement, par exemple pour le résilier à la fin de la période en cours avec cancel_at_period_end, ou pour annuler cela. Modifier les éléments ou prix de l'abonnement n'est pas disponible ici.

Identifiant
stripe_update_subscription

L'appel

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

{
  "customer_toolkit": "<connection UUID>",
  "arguments": {
    "subscription": "<subscription>"
  }
}

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
subscriptionstringOuiId of the subscription, starting with sub_, from List subscriptions or Search subscriptions.
cancel_at_period_endbooleanNontrue cancels the subscription at the end of the current period, and false undoes a cancellation scheduled this way.
cancel_atintegerNonUnix timestamp, in seconds, at which the subscription is canceled. A date before the end of the current period prorates according to proration_behavior.
descriptionstringNonDescription of the subscription, shown to the customer.
trial_endstringNonEnd of the trial, as a Unix timestamp in seconds, or now to end the trial right away.
collection_methodstringNoncharge_automatically charges the default payment method of the customer; send_invoice emails each invoice with payment instructions and needs days_until_due.Valeurs : charge_automatically, send_invoice
days_until_dueintegerNonDays the customer has to pay each invoice. Only with collection_method send_invoice.
proration_behaviorstringNonHow a change that affects the billing is prorated: create_prorations (the default) adds the proration to the next invoice, always_invoice invoices it right away and none skips it.Valeurs : always_invoice, create_prorations, none

Connexions possibles

Votre client connecte son compte Stripe 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/stripe_update_subscription. Il devient la définition de tool de votre agent sans conversion.

Autres tools Stripe

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.