Node.js Stripe Subscription 更新

updated Oct 6, 2021created Oct 6, 2021
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