#ramires_checkout-connect

1 messages ยท Page 1 of 1 (latest)

winged meadowBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1273751701748449345

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

cosmic anchorBOT
#

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.

simple acorn
agile scarab
#

@simple acorn can you share the exact Checkout Session id as text instead of a picture so I can help you?
In general it's much better to share text even for code instead of pictures too

simple acorn
#

Sure!
cs_test_b16GZ9bGKEhQ4OM22nHPM4zfCnwxFTVsHD6CI0FG8m6wCGWyniMsH62M9e

agile scarab
#

ramires_checkout-connect

simple acorn
#
try {
            $session = $this->stripeClient->checkout->sessions->create([
                'line_items' => $instance->products->map(function ($product) {
                    return [
                        'price_data' => [
                            'currency' => 'eur',
                            'product_data' => ['name' => $product->title],
                            'unit_amount' => Number::convertMoneyStringToInteger($product->unit_price_with_iva)
                        ],
                        'quantity' => $product->qty,
                    ];
                })->toArray(),
                'payment_intent_data' => [
                    'application_fee_amount' => Number::convertMoneyStringToInteger(
                        formatMoney($this->getOrderTotalValue($instance) * 0.049)
                    )
                ],
                'shipping_options' => [[
                    'shipping_rate_data' => [
                        'type' => 'fixed_amount',
                        'fixed_amount' => [
                            'amount' => Number::convertMoneyStringToInteger($instance->shipping_cost),
                            'currency' => 'eur'
                        ],
                        'display_name' => 'Custo total do porte',
                    ]
                ]],
                'customer_email' => $client->email,
                'mode' => 'payment',
                'ui_mode' => 'embedded',
                'return_url' => route('cart.stripe.finish_order', $instanceUuid) . "?session_id={CHECKOUT_SESSION_ID}"
            ], [
                'stripe_account' => config('checkout.stripe.env.' . (config('checkout.sandbox') ? 'sandbox' : 'live') . '.account_id')
            ]);
        } catch (Exception $e) {
            dd($e->getMessage());
        }

When I created the session, I explicitly informed the connected account. Should I also inform the retrieve method?

agile scarab
#

yes! You need to tell us the right connected account every time you make an API request

simple acorn
#

Ah yes, sorry for this mistake.
Let me try here

agile scarab
#

no problem at all, it's not an obvious thing to realize at first!

simple acorn
#

Really lol

#

Very good. Now I am correctly getting the data.

Question: is this session_id information that I can store in my database to check payment details later?

agile scarab
#

yes that's usually recommended

simple acorn
#

Excellent.
I'll continue with my implementation, thanks so far.

Now I'm going to test webhooks

agile scarab
#

good luck ๐Ÿ™‚