#kitem - upcoming invoice

1 messages ยท Page 1 of 1 (latest)

cyan marsh
#

I think instead of doing invoice items, you should pass in the Subscription's ID to the subscription parameter and pass the invoice items in as subscription_items

#

If just invoice_items are provided, that would simulate these invoice items being added to the next invoice rather than being on an invoice of their own

coarse linden
#

Ok, I'm trying

#

because before this code I was trying with the subscription_items

#

actually I can have different subscription_items inside the subscription

#

but I wasn't passing the specific subscription because i thought it was took directly by the custom id

#

*customer id

#

Changing code to this:
$upcoming = \Stripe\Invoice::upcoming(
[
'customer' => 'cus_xxxx'
],
['subscription_items' =>
[
'price' => price_xxxx,
'quantity' => 1
],
]
);
print the same result of invoice_items, where I've missed the "subscription" parameter?

cyan marsh
#

I forget exactly how it pulls the items here but can look. If you do pass the subscription ID as well does anything change?

coarse linden
#

Passing subscription in this way
$upcoming = \Stripe\Invoice::upcoming(
[
'customer' => 'cus_xxxx',
'subscription' => 'sub_xxxx'
],
['subscription_items' =>
[
'price' => price_xxxx,
'quantity' => 1
],
]
);

Or in this way

    $upcoming = \Stripe\Invoice::upcoming(
        [
            'customer' => 'cus_xxxx',
        ],
        [
                            'subscription' => 'sub_xxxx',
                            'subscription_items' => 
                [
                        'price' => price_xxxx,
                        'quantity' => 1
                ],
        ] 
);
#

is the same result of the first case

#

is like I'm getting the current upcoming, without evaluating the "switch" to the plan I'm passing I say this because the total returned from these cases is the same total of the plan I already have. (and in the plan parameter I still get the plan currently active without mention to the new one)

cyan marsh
#

Gotcha. I will test to see if I can find the proper way to do this

#

So when you do it either of those ways, it still shows you the price of the current subscription plus what you are adding in via this call?

coarse linden
#

Nono, it shows only the current plan active, it not mention the new one

#

Inside the lines->data[0] ->plan and lines->data[0]->price I have only the one element that is already active on my subscription

#

Example here, I've premium_test active on my subscription, I'm switching to another plan, but response from that upcoming returns only what I've now

#

this results in a total to pay that is 299, exactly the cost of this premium_test plan. But I'm switching to another one that cost 99, this other one plan is not mentioned anywhere in the response

cyan marsh
#

Gotcha. Sorry had to jump around threads a bit and am just getting back to this. Will figure out how to make this call and send you the code that I find

coarse linden
#

Don't worry, I'm here and I'm trying to solve

#

in case I'll solve I'll write back to you ๐Ÿค“

coarse linden
#

I still can't figure out /: , looking how it works the call from dashboard I'm trying to simulate the same on the API, but still not working

#

It does not seems so different from how I was doing that, but following all these steps seems working

twin dew
#

Hi there ๐Ÿ‘‹ apologies for the delay as I'm working to get caught up. It looks like you were able to find what you were looking for, but please let me know if that's not the case.