Node.js Stripe Subscription 更新

created 2021/10/06updated 2021/10/06
js
const subscription = await stripe.subscriptions.retrieve( "sub_xxxx", // Userモデルに保存したsubscriptionId ); const params = { items: [ { id: subscription.items.data[0].id, plan: "price_xxxx", // 新しいプラン }, ], }; const updatedSubscription = await stripe.subscriptions.update( "sub_xxxx", // Userモデルに保存したsubscriptionId params, );

Stripe API Reference - Update a subscription - cURL