#ramires_checkout-connect
1 messages ยท Page 1 of 1 (latest)
๐ 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.
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.
- ramires-gomes_code, 28 minutes ago, 9 messages
@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
Sure!
cs_test_b16GZ9bGKEhQ4OM22nHPM4zfCnwxFTVsHD6CI0FG8m6wCGWyniMsH62M9e
ramires_checkout-connect
Okay you seem to be using Stripe Connect and you are creating a Checkout Session on a connected account which means you are using Direct Charges.
So when you are trying to retrieve that Checkout Session you need to tell us explicitly which connected account it is on. See https://stripe.com/docs/connect/authentication#stripe-account-header
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?
yes! You need to tell us the right connected account every time you make an API request
Ah yes, sorry for this mistake.
Let me try here
no problem at all, it's not an obvious thing to realize at first!
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?
yes that's usually recommended
Excellent.
I'll continue with my implementation, thanks so far.
Now I'm going to test webhooks
good luck ๐