#kiranovatheofficial

1 messages · Page 1 of 1 (latest)

signal phoenixBOT
surreal smelt
#

Hi there!

surreal panther
#

Hello 🙂

surreal smelt
#

So you want to automatically send an payment receipt by email when using the Checkout Session?

surreal panther
#

Exactly!

surreal smelt
surreal panther
#

Oh! Let me see

surreal smelt
#

Also note that we don't send emails in test mode, onlyl in live mode.

surreal panther
#

Oh ok yes I get it

#

So if this option is enabled, the person that pay and succeed on the checkout session, got emailed with the receipt ?

#

In love mode

surreal smelt
#

correct

surreal panther
#

Sounds good. Thank you

#

I might have another request

surreal smelt
#

sure, what's your question?

surreal panther
#

Once the person is on the checkout session, is there a way to trigger some code to add another constraint to the chekout validation?

#

Once he click on the button 'pay'

surreal smelt
#

What constrains for example?

surreal panther
#

I would like to check at the very last step my product stock... so we avoid overselling

#

I already do it until he gets on the chekout session

#

but if 2 people are in the checkout session.. i don't want them both to be able to buy an article that has only 1 in stock...

#

I have this information in my database. I wish I'll be able to check the stock of my product at the very last click before the person pays

surreal smelt
surreal panther
#

It looks like this thing is plugged to a payment intend but I don't use paymentIntents

#
      $checkout_session = Session::create([
            'line_items' => $productsForStripe,
            'mode' => 'payment',
            'success_url' => $YOUR_DOMAIN . '/commande/valide/{CHECKOUT_SESSION_ID}',
            'cancel_url' => $YOUR_DOMAIN . '/commande/echec/{CHECKOUT_SESSION_ID}',
        ]);
#

Should I add it there?

surreal smelt
#

but I don't use paymentIntents
Checkout Session automatically create PaymentIntents for you

surreal panther
#

Alright! and then ```php
$stripe->paymentIntents->capture(
'pi_number',
[]
);

surreal smelt
#

yep

surreal panther
#

The only thing I'm struggling with is getting the pi_number

#

can I get the payment intent ID from the response of the checkout session? and how?

surreal smelt