#Nrupal Patel
1 messages · Page 1 of 1 (latest)
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.
but in this code call created subscription update api in webhook
Can you share the two events ID in your screenshots (evt_xxx)?
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..
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
so for update subscription what i have to do..
checkout.session.completed orstripe.checkout.Session.create ?
so for update subscription what i have to do..
What do you mean? What are you trying to do?
could please shared code for that?
for this?
it is possible using checkout.Session api?
If you want to update an existing subscriptions: https://stripe.com/docs/api/subscriptions/update
it is possible using checkout.Session api?
No, with Checkout Session you can only create new subscriptions.
so how can get charge's for update subscription?
Sorry I don't understand your question. What are you trying to do exactly?
update subscription amount is more than old subscription so how can stripe manage this?
or i have to manage?
Hello 👋
Apologies for the delay here