#Leonardo-Checkout

1 messages ยท Page 1 of 1 (latest)

wanton mason
#

Hi there, can you share with me the checkout ID?

vivid yoke
#

yes. Just one sec

#

cs_test_a1rclOurAhZVX5coMRsEIDnlP96I07Yk4JAlXCkjUAvpfcorhROVjTbhXn

#

should be this one

wanton mason
#

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?

vivid yoke
#

yes ๐Ÿ˜„

#

funny. I haven't changed a thing, but looks like its working now

wanton mason
#

Did you create the checkout session in front-end or backend?

vivid yoke
#

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?

wanton mason
#

OK, how do you open the checkout session URL?

vivid yoke
#

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

wanton mason
#

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.

vivid yoke
#

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

wanton mason
#

you need to pass the connected account's ID (not your ID) to this param.