I am using stripe to implement payment feature. In payment feature I have two subscription plan monthly and yearly respectively. From stripe dashboard I created product and under that created two plans monthly and yearly. As per the name I set interval to monthly and yearly respectively.
I am successfully able to create subscription. But when I try to change my subscription plan I am getting this error: Currency and interval fields must match across all plans on this subscription. Found mismatch in interval field.
Error saying that currency and interval must match. But how can I make them same. For monthly plan I set monthly interval and for yearly plan I set yearly interval which is proper I guess. Don't know where I mistaken.
Here is my code:
const subscription = getSubscription(req.body.subscriptionId);
subscription.then((value) => {
id = value.id;
})
stripe.subscriptions.update(
req.body.subscriptionId,
{
items: [{
id: id,
plan: req.body.planId,
}]
},
function(err, subscription) {
if(err) {
console.log('error .... ', err);
return;
}
console.log('updated subscription... ', subscription);
});
async function getSubscription(subscriptionId) {
return await stripe.subscriptions.retrieve(subscriptionId);
}
I took this code from this: https://stripe.com/docs/billing/subscriptions/upgrading-downgrading
Please help me out.
req_xxxyyy
to stripe and they can take a look and what's going on – duck