#burhanriaz35

1 messages · Page 1 of 1 (latest)

molten coralBOT
vivid bane
#

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

limber hull
#

@potent mango let's keep talking here.

#

What is your follow up Question?

potent mango
#

have you read question?

limber hull
#

yep, and I think my colleauge already answered you.

limber hull
potent mango
#

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

limber hull
#

but payment detect two times ...
What you mean by this , can you share some exmple (Ids)?

potent mango
#

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

limber hull
#

This is your code. what is detected twice and what is the issue ? I'm not understanding you.

potent mango
#

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

limber hull
#

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?

potent mango
#

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 ..

limber hull
#

the question is the process which is I’m try is correct?
Yes, listening to the checkout.session.completed event is a good option.

potent mango
#

but the payment cut two time the main issue that

wraith nymph
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

#

Could you please summarise the latest question?

potent mango
#

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

wraith nymph
#

What do you mean by "payment cut"?

potent mango
#

payment detect

wraith nymph
#

I don't understand what this means.

potent mango
#

two time charges from customer

wraith nymph
#

Do you want to save a Payment Method from a customer and then charge it multiple times?

potent mango
#

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

wraith nymph
#

I have, and I still don't understand what you are trying to achieve. Do you just want to create a monthly subscription?

potent mango
#

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;
    }
wraith nymph
potent mango
#

the above method creating subscription

wraith nymph
potent mango
#

i have read 100 of time

wraith nymph
potent mango
#

this method is correct and work fine
after this in front end i have create check out session which is detect blance 2nd time

wraith nymph
#

Why do you need another Checkout Session?

#

You can charge the saved payment method without Checkout Session.

potent mango
#

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 ..

wraith nymph
potent mango
#

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

wraith nymph
#

You can get the prices from Invoice.lines.data.price

potent mango
#

PublisherId = "bab96147-7968-42fc-9e2b-f92715b295cd",
what about this id is save in Db which is need on call back event

wraith nymph
#

I don't know what is this ID or what is Publisher. Does this come from your app?

potent mango
#

yes

wraith nymph
#

Where does it come from?

#

Is it related to a Customer or Invoice or Subscription?

molten coralBOT