#Jenya - Subscription Creation
1 messages · Page 1 of 1 (latest)
Hello. Let's chat in this thread
Give me just a moment to catch up
So that api call looks like it's a subscription update call
You say you're creating a subscription like that?
I think you may have just shared the wrong code snippet
Sorry, not creating subscription
When upgrading
I have existing subscription and updating the items
Ah got it
Can you share a request ID for the update call where you aren't seeing an invoice being created?
It is being created
Just auto paid
I need to somehow retrieve it and redirect the user to it
But the update doesn't return it
I think for your use-case, you would want default_incomplete for the payment behavior: https://stripe.com/docs/api/subscriptions/update#update_subscription-payment_behavior.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
@dark remnant That upgrades automatically
Invoice isn't auto paid which is good
But user get's upgraded before invoice is even paid
I see. You could configure your account settings to cancel the subscription, though, if the invoice is past_due for a certain period of time: https://dashboard.stripe.com/settings/billing/automatic
I need it to not be enabled until paid
That's what the pending_until_complete was doing
Maybe I can just get the invoice and redirect user to it?
Or remove the payment method, so that it doesn't auto charge
Can you send your whole request?
What are all the parameters you're passing in?
Also, can you try using send_invoice for this parameter? https://stripe.com/docs/api/subscriptions/update#update_subscription-collection_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
It's just two items below that
const sub = await stripe.subscriptions.update(subscriptions.data[0].id, {
payment_behavior: 'pending_if_incomplete',
proration_behavior: 'always_invoice',
items: [
{
id: subscriptions.data[0].items.data[0].id,
price: priceIds[0].price,
quantity: priceIds[0].quantity
},
{
id: subscriptions.data[0].items.data[1].id,
price: priceIds[1].price,
quantity: priceIds[1].quantity
}
]
});
catching up here give me a sec.
Just to word the question back - you want to upgrade the user but wait for it to be paid in full? is that right?
why do you want to bring the customer back on session though, you already have their cards attached to the customer so they don't need to come back online
Yeah
Maybe they want to use another card or something
Like they click a button to upgrade
And it needs to redirect to some sort of payment page you know
I do that for initially buying a plan
But from what I've seen I can't use checkout session for upgrading, only creating new subscription