#Leonardo-Checkout
1 messages ยท Page 1 of 1 (latest)
yes. Just one sec
cs_test_a1rclOurAhZVX5coMRsEIDnlP96I07Yk4JAlXCkjUAvpfcorhROVjTbhXn
should be this one
This checkout session was created two days ago, the checkout session expires in 24 hours by default. Can you create a new one and see if it's working fine?
Did you create the checkout session in front-end or backend?
Backend ๐ค
const session = await this.stripe.checkout.sessions
.create(
{
payment_method_types: paymentMethods,
line_items: itemList,
mode: mode,
success_url: A.absoluteUrl(
`${successURL}?${mode === 'payment' ? 'payment' : 'subscription'}=${client_reference_id}`,
),
cancel_url: A.absoluteUrl(
`${cancelURL}?${mode === 'payment' ? 'payment' : 'subscription'}=${client_reference_id}`,
),
client_reference_id,
customer_email: user.email,
...(stripe_connectID
? {
payment_intent_data: {
application_fee_amount: 123,
transfer_data: {
destination: stripe_connectID,
},
},
}
: {}),
},
stripe_connectID ? { stripeAccount: this.accountToken } : {},
)
"stripe_connectID" has to be my acc iD right?
And "destination" has to be the connect acc that should receive the money?
OK, how do you open the checkout session URL?
With redirectToCheckout. I send the session id back to the client and I execute:
const stripeCheckout = (await Payment.getStripeClient())?.redirectToCheckout({ sessionId: stripePayment });
stripePayment is the backend result
OK, I see you are creating a checkout session for connected account, if you want to use redirectToCheckout, you need to ensure the correct connect account is included when initializing the Stripe.js.
Now it seems to work.
"stripe_connectID" has to be my acc iD right?
And "destination" has to be the connect acc that should receive the money?
I think to recall that stripe_connectID has to be my account. It works too. But I'm not totally sure
so when you initialize Stripe.js, there is an optional field called stripeAccount (https://stripe.com/docs/js/initializing#init_stripe_js-options-stripeAccount)
you need to pass the connected account's ID (not your ID) to this param.