#eyupensar

1 messages · Page 1 of 1 (latest)

fluid cryptBOT
#

Hello eyupensar, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
eyupensar, 4 days ago, 20 messages
eyupensar, 4 days ago, 15 messages
eyupensar, 5 days ago, 4 messages

orchid lintel
#

@lone tundra to get the email of user after succefull payment , you must include metadata in your checkout session. And then you can retrieve that data in the webhooks sessions!

lone tundra
#

I also need the shipping address

orchid lintel
#

In python you can do that like this:
checkout_session = stripe.checkout.Session.create(
# new
client_reference_id=request.user.id if request.user.is_authenticated else None,
success_url="https://simplestudying.com/" + f'?redirect_page={redirect_page}',
cancel_url="https://simplestudying.com/",
# payment_method_types=['card'],
# payment_method_types=['card','klarna'],
customer=request.user.customer_id,
mode=mode,
line_items=[
line_items
],
metadata={
"appoitment_id": json.dumps(obj),
"plan_id":""
},
),

lone tundra
#

I use js

#

this is my code

#
    //console.log(req.body.products);
    const items = req.body.products;
    let lineItems = [];
    items.forEach((item) => {
        lineItems.push(
            {
                price: item.stripe_price,
                quantity: item.amount,
                adjustable_quantity: {
                    enabled: true
                }
            }
        )
    });


    const session = await stripe.checkout.sessions.create({
        line_items: lineItems,
        mode: 'payment',
        success_url: "https://downers.store/",
        cancel_url: "https://downers.store/cart",
        payment_method_types: ["card"],
        billing_address_collection: 'required', 
        shipping_address_collection: {
            allowed_countries: ['US', 'CA'], 
        },
        allow_promotion_codes: true,
    });

    res.send(JSON.stringify({
        url: session.url
    }));
});```
next fern
#

@lone tundra what do you receive in the checkout.session.completed webhook event?

#

Do you see a Payment Method Id?

next fern
#

After a Checkout Session is paid, you will receive a webhook event checkout.session.completed

lone tundra
#

can I get the docs link

next fern
lone tundra
#

ok I will check this. Where will I get the user's address and email information? from here?

#

Watch Part 1 - Stripe Payment: https://youtu.be/72iEz5iopqQ
Full Course: https://youtube.com/playlist?list=PL63c_Ws9ecIRnNHCSqmIzfsMAYZrN71L6

Sections:
00:00 - intro
01:08 - install stripe CLI
05:07 - create webhook endpoint
15:50 - handling checkout success event
25:45 - create order model
31:26 - save order to database

✨ Join My Discord Ser...

▶ Play video
#

ok I found a video

#

I will follow this ty