#Yashish
1 messages · Page 1 of 1 (latest)
Can you elaborate on which integration you are following?
i want user to update the subscription and then want user to redirect to the stipe url for the payment after successfull payment user can redirect to my website
right now i am doing the plan updation like
subscription = subscription.modify(
subscription_id,
proration_behavior='always_invoice',
items=[subscription_item],
payment_behavior='pending_if_incomplete',
)
subscription = stripe.Subscription.retrieve(subscription_id)
invoice = stripe.Invoice.retrieve(subscription.latest_invoice, expand=['payment_intent'])
invoice_url = invoice.hosted_invoice_url
print("661 invoice_url-->",invoice_url)
return redirect(invoice_url)
here but after the payment user is not redirected to my website
Ah okie this is Hosted Invoice Page
Unfortunately we don't have an option to allow to redirect back after finish payment here
It's not supported unfortunately, sorry for the inconvenience
forgot my implementation
is there another way to update the user subscription if the payment for the subscription is successfully on the url and then redirect to my site
If you to build an UI to collect payment yourself, not relying on Hosted Invoice Page
no want user to do the payment which is performed like
which is performed in
stripe.checkout.Session.create
where user is redirected to a stripe url for the payment
I understand, but Hosted Invoice Page doesn't have the redirect functionality, unfortunately
forgot about Hosted Invoice Page
can we do it in another way
Customer Portal, similar to Checkout and can setup a return URL
no do not want to use customer portal
Why?
my tl wants everything should be handled on our website
But you said you wanted redirect?...
yes just like this
checkout_session = stripe.checkout.Session.create(
success_url="https://example.com/success",
cancel_url="https://example.com/cancel",
payment_method_types=["card"],
line_items=[{
'price': price_id,
'quantity': 1
}],
mode='subscription',
customer=customer_id,
)
Ok, then what's the specific issue?
i want to perform similar action in subscription update
Then you'd use the customer portal, you can configure a redirect there with a deep link flow: https://stripe.com/docs/customer-management/portal-deep-links
Checkout doesn't support updating existing subscriptions
That's the only hosted UI that will allow a subscription update with a redirect back to your site after customer completes the update
But equally confused as my colleague as you keeping saying you want to handle everything on your site, but then also reference Checkout (a hosted UI)
do not want to use customer portal
Then I'm not sure what elese to suggest other than building your own UI to handle the update
for subscription update
subscription = subscription.modify(
subscription_id,
proration_behavior='always_invoice',
items=[subscription_item],
payment_behavior='pending_if_incomplete',
)
subscription = stripe.Subscription.retrieve(subscription_id)
invoice = stripe.Invoice.retrieve(subscription.latest_invoice, expand=['payment_intent'])
invoice_url = invoice.hosted_invoice_url
can we use stripe.checkout.Session.create for the payment of invoice_url
No that's not possible
any other way to update subscription
You can:
- Use the customer portal
- Modify via the API (like you are), and send the
hosted_invoice_pageURL - Modify via the API, and build your own UI to handle the payment
any thing directly provided by stripe?