#james-subscription-preview

1 messages · Page 1 of 1 (latest)

smoky havenBOT
quaint moat
#

im getting this error: Currency and interval fields must match across all plans on this subscription. Found mismatch in interval field.

dry skiff
#

james-subscription-preview

#

The API for this is a little bit... convoluted if you ask me 😅
What you do basically is simulate a change to the underlying Subscription. So you have to explicitly replace price A by price B in the call

quaint moat
#

Yes thats annoying

dry skiff
#

So if your Subscription has one Price A you have a SubscriptionItem si_123 for it. And when you preview a change you need to say "hey imagine si_123 wasn't on Price A anymore but on Price B"

#

The logic is that if you have 5 Prices, so 5 SubscriptionItems and you want to add a sixth Price all you have to do is pass that 6th Price. So it makes that flow easy but then your flow a bit more confusing

#

Does that make sense?

quaint moat
#

so an existing SI can only be edited to another price that has the same interval?

dry skiff
#

no I didn't say that and it just works

quaint moat
#

atm i have existing SI's and they have monthly price ids

dry skiff
#
Stripe::Invoice.upcoming({
  customer: 'cus_123',
  subscription_items: [
    {
      id: 'si_123',
      price: 'price_Yearly',
    },
  ]
})
#

something like this should work assuming you have just one Price

quaint moat
#

i should be able to edit the SI to be an annual price id without deleting the SI ?

dry skiff
#

correct

quaint moat
#

thats not working

dry skiff
#

it is

#

but if you give detailed information: exact code, exact request id, exact error, I can help.

quaint moat
#

is the answer in this correct?

dry skiff
#

I mean yes and no. IT's correct, it answers the question. The question explicitly added a yearly Price, it didn't replace. It's missing the id parameter I explicitly put in my own code

quaint moat
#

in my example the existing subscription items are like this

#

subscription_items: [
{
id: 'si_123',
price: 'price_Monthly',
}, {
id: 'si_456',
price: 'price_Monthly',
},

#

i am trying to do this:

#

Stripe::Invoice.upcoming({
customer: 'cus_123',
subscription_items: [
{
id: 'si_123',
price: 'price_Yearly',
}, {
id: 'si_456',
price: 'price_Yearly',
},
]
})

dry skiff
#

That should work. If you give me exact code + exact request id I can help

quaint moat
#

and getting the error:Currency and interval fields must match across all plans on this subscription. Found mismatch in interval field.

#

i will double check and come back

#

i have checked and it definitely doesn't work

#

this is my code

#

$invoice = $stripe->invoices->upcoming([
'customer' => $customers_id,
'subscription' => $active_subscription_id,
'subscription_items' => $revised_subscription_items,
'subscription_proration_behavior' => $proration_behaviour
]);

dry skiff
#

Sure, please give me an exact request id req_123 and I can help you. Sorry to keep asking the same but that's what I need

#

Okay I just tried that exact flow on my end and it works totally fine

quaint moat
#

I need to go now

#

Can I reply with the details later