#Nrupal Patel

1 messages · Page 1 of 1 (latest)

young oysterBOT
keen compass
#

Hi there!

#

The code you shared only creates a single subscription. If you see two subscriptions created, it means your code was run twice and the customer submitted the form twice.

sleek mirage
#

but in this code call created subscription update api in webhook

keen compass
#

Can you share the two events ID in your screenshots (evt_xxx)?

sleek mirage
#

evt_1MtVHvGHHZulkLhFlS59CuNH,and evt_1MtVHvGHHZulkLhFrw1jq5HH,

#

checkout_session = stripe.checkout.Session.create(
payment_method_types=["card"],
line_items=[
{
"price": "price_1MrIoNGHHZulkLhF89iAHCGY",
"quantity": 1,
},
],
mode="subscription",
customer="cus_NZDffJVyRxDBXV",
success_url=request.build_absolute_uri(reverse("success"))
+ "?session_id={CHECKOUT_SESSION_ID}",
cancel_url=request.build_absolute_uri(reverse("failed")),
)
my code for..

keen compass
#

Oh you are right, both events are for the same subscriptions. Having a look...

#

Yes so I had a look and this is expected. First the Checkout Session creates the subscription (so you get customer.subscription.created), and then the use pays for it and you get (so you get customer.subscription.updated).

#

If you are using Checkout Session, you should listen to checkout.session.completed instead

sleek mirage
#

so for update subscription what i have to do..
checkout.session.completed orstripe.checkout.Session.create ?

keen compass
#

so for update subscription what i have to do..
What do you mean? What are you trying to do?

sleek mirage
sleek mirage
keen compass
sleek mirage
#

it is possible using checkout.Session api?

keen compass
#

No, with Checkout Session you can only create new subscriptions.

sleek mirage
#

so how can get charge's for update subscription?

keen compass
#

Sorry I don't understand your question. What are you trying to do exactly?

sleek mirage
#

update subscription amount is more than old subscription so how can stripe manage this?
or i have to manage?

dry halo
#

Hello 👋
Apologies for the delay here