#Yashish

1 messages · Page 1 of 1 (latest)

rigid wraithBOT
stark urchin
#

Can you elaborate on which integration you are following?

narrow stump
#

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

stark urchin
#

Ah okie this is Hosted Invoice Page

#

Unfortunately we don't have an option to allow to redirect back after finish payment here

narrow stump
#

can you suggest any other way to do it

#

?

stark urchin
#

It's not supported unfortunately, sorry for the inconvenience

narrow stump
#

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

stark urchin
#

If you to build an UI to collect payment yourself, not relying on Hosted Invoice Page

narrow stump
#

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

stark urchin
#

I understand, but Hosted Invoice Page doesn't have the redirect functionality, unfortunately

narrow stump
#

forgot about Hosted Invoice Page

can we do it in another way

stark urchin
#

Customer Portal, similar to Checkout and can setup a return URL

narrow stump
#

no do not want to use customer portal

stark urchin
#

Why?

narrow stump
#

my tl wants everything should be handled on our website

stark urchin
rigid wraithBOT
narrow stump
#

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,
)

mossy herald
#

Ok, then what's the specific issue?

narrow stump
#

i want to perform similar action in subscription update

mossy herald
#

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)

narrow stump
#

do not want to use customer portal

mossy herald
#

Then I'm not sure what elese to suggest other than building your own UI to handle the update

narrow stump
#

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

mossy herald
#

No that's not possible

narrow stump
#

any other way to update subscription

mossy herald
#

You can:

  • Use the customer portal
  • Modify via the API (like you are), and send the hosted_invoice_page URL
  • Modify via the API, and build your own UI to handle the payment
narrow stump
#

any thing directly provided by stripe?