#burhanriaz35
1 messages · Page 1 of 1 (latest)
Hi there!
Pasting your other message here:
after these 8 steps i have create a check out session from front end with client refence id
the client refrence required in webhook call.
but payment detect two times ...
Is right way ?
I need to call a check out session complete event when webhook called.
The issue is the check out session complete is not calling
Is your goal to create a subscription? Then I recommend following the flow described here https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements or here https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=checkout
have you read question?
yep, and I think my colleauge already answered you.
Does this answer your question ?
after these 8 steps i have create a check out session from front end with client refence id
the client refrence required in webhook call.
but payment detect two times ...
Is right way ?
I need to call a check out session complete event when webhook called.
The issue is the check out session complete is not calling
but payment detect two times ...
What you mean by this , can you share some exmple (Ids)?
var checkoutOptions = new SessionCreateOptions
{
Customer = "cus_O9Vqx4mgMkpcb7",
LineItems = new List<SessionLineItemOptions>
{
new SessionLineItemOptions
{
Price = "price_1NSgRSITdhxmz1XjNWLLZ3S1",
Quantity = 1,
}
},
Currency = _price?.Currency,
Mode = "subscription",
SuccessUrl = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}/success.html",
CancelUrl = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}/cancel.html",
ClientReferenceId = JsonConvert.SerializeObject(new
{
PriceId = "price_1NSgRSITdhxmz1XjNWLLZ3S1",
PublisherId = "bab96147-7968-42fc-9e2b-f92715b295cd",
ProductId = "prod_NaErygUyJQ0VW9",
})
};
var service = new SessionService();
var session = await service.CreateAsync(checkoutOptions);
the same code added in front for check out session
i want check out session with prefill data just for confirmation
This is your code. what is detected twice and what is the issue ? I'm not understanding you.
please read it from start to end
i hope you will understand what is I'm asking
first time payment detect from backend
2nd time payment detected from front end check out session
Sorry, not understanding this part:
but payment detect two times ...
Is right way ?
I need to call a check out session complete event when webhook called.
The issue is the check out session complete is not calling
Could you pleaase rephrase it with some concrete examples ? like PaymentIntent Ids, checkout session Ids, Event Ids?
First Payment cut here …… the above given create method
var subscription = new SubscriptionService().Create(creationOptions);
here is payment detected and subscription created
/////////////////////////////
after these 8 steps i have create a check out session from front end with client refence id as Json Object with some specific ids which is required in webhook call to update data base
CustomerId, ProductId, PriceId and
PublisherId is organization Id each customer have multiple organization in system.
When I have created check out session from front end the payment detected again ….
the client reference Id object required when webhook called event data for update DB.
I need to call a check out session complete event for db update…
the question is the process which is I’m try is correct?
if no then how to achieve this same as my flow
I want on check out page pre fill data of this customer details just click confirm button and no payment detect here again ..
the question is the process which is I’m try is correct?
Yes, listening to the checkout.session.completed event is a good option.
You can find more details here:
https://stripe.com/docs/payments/checkout/fulfill-orders
but the payment cut two time the main issue that
Hi! I'm taking over from my colleague. Please, give me a moment to catch up.
Could you please summarise the latest question?
Step 1 : Create Payment Method From Front end and send payment method Id to backend
https://api.stripe.com/v1/payment_methods
the above Api use to create payment method
step 2: back end Create subscription and cut payment
step 3: create check out session from front end the payment again cut here
and also read out latest file msg
What do you mean by "payment cut"?
payment detect
I don't understand what this means.
two time charges from customer
Do you want to save a Payment Method from a customer and then charge it multiple times?
have you read the file ?
recuing already added when product created i need customer pay us in a month one time when start subscription according to given flow the payment charge from customer two time
1 charge when subscription create
2 charge when check out session
I have, and I still don't understand what you are trying to achieve. Do you just want to create a monthly subscription?
yes
public string Create(PaymentSubscriptionCreationOptions paymentCustomer)
{
var creationOptions = new SubscriptionCreateOptions()
{
Customer = paymentCustomer.PaymentCustomerId,
Items = new List<SubscriptionItemOptions>()
{
new SubscriptionItemOptions()
{
Price = paymentCustomer.PaymentPriceId,
Quantity = paymentCustomer.Quantity
}
}
};
creationOptions.AddExpand("latest_invoice.payment_intent");
creationOptions.AddExpand("pending_setup_intent");
var subscription = new SubscriptionService().Create(creationOptions);
return subscription.Id;
}
Please go through this guide: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=elements
the above method creating subscription
If you want to create a Subscription via Checkout, use this: https://stripe.com/docs/billing/subscriptions/build-subscriptions?ui=checkout
i have read 100 of time
Is there any issue with this function?
this method is correct and work fine
after this in front end i have create check out session which is detect blance 2nd time
Why do you need another Checkout Session?
You can charge the saved payment method without Checkout Session.
so the old developer added check out session event to update db
can i call check out session pre fill data and just for confirmation and no payment detected ..
No. Please listen to invoice.paid event. It will fire every time the Subscription is renewed: https://stripe.com/docs/api/events/types#event_types-invoice.paid
I need some Extra data which is i want to added as json object Like
ClientReferenceId = JsonConvert.SerializeObject(new
{
PriceId = "price_1NSgRSITdhxmz1XjNWLLZ3S1",
PublisherId = "bab96147-7968-42fc-9e2b-f92715b295cd",
ProductId = "prod_NaErygUyJQ0VW9",
})
i need to these Id for some update in db
How can add this in Invoice.Paid Event
You can get the prices from Invoice.lines.data.price
PublisherId = "bab96147-7968-42fc-9e2b-f92715b295cd",
what about this id is save in Db which is need on call back event
I don't know what is this ID or what is Publisher. Does this come from your app?
yes