Last active
November 30, 2023 19:16
-
-
Save guanzo/f134245cee5871d9f3e7e758742ff44f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const res = await stripe.subscriptions.update(subscriptions[0].id, { | |
default_payment_method: paymentMethods[0].id, | |
billing_cycle_anchor: 'unchanged', | |
proration_behavior:'always_invoice', | |
items: [ | |
...subscriptions[0].items.data.map((item) => ({ | |
id: item.id, | |
deleted: true, | |
clear_usage: | |
item.plan.usage_type === 'metered' ? true : undefined, | |
})), | |
{ | |
price: opts.input.priceId, | |
}, | |
], | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment