#stachujone5

1 messages · Page 1 of 1 (latest)

atomic gladeBOT
solar mountain
#

Express Checkout Element doesn't have a line items concept I'm afraid

potent girder
#
  const stripeSession = await stripe.checkout.sessions.create({
    line_items: boughtProductsWithBoughtVariants.map((bm) => {
      return {
        price: bm.product.priceId,
        quantity: bm.quantity
      };
    }),
    mode: 'payment',
    success_url: successURL,
    cancel_url: cancelURL,
    ...(user?.customerId ? { customer_update: { shipping: 'auto' } } : {}),
    customer: user?.customerId ?? undefined,
    shipping_options: [{ shipping_rate: 'some rate' }],
    shipping_address_collection: {
      allowed_countries: allowedCountries
    },
    automatic_tax: {
      enabled: true
    },
    invoice_creation: {
      enabled: true
    },
    allow_promotion_codes: true,
    metadata: {
      type: 'merch',
      orderId: order.id,
      cartId: input.cartId ?? null
    }
  });
#

Thats how I use normal checkout

#

I'd like to do the same but with apple pay button

#

and google pay button

#

embedded on my page

#

From reading the docs I see that I should use ExpressCheckout element

#

What should I do to implement the same logic for express checkout as I do in normal checkout?

solar mountain
#

As I stated, you can't use line items with Express Checkout Element. You interact with the Payment Intents APIs directly which don't have a line item field/concept

potent girder
#

Okey so lets assume that I dont pass line items, just a full amount.

Then user pays and webhook runs. How do I proceed the webhook and pass all the necessery info such as product info etc.

potent girder
potent girder
solar mountain
#

Then user pays and webhook runs. How do I proceed the webhook and pass all the necessery info such as product info etc.
Well, you can't because Payment Intents don't work with Products/Prices directly

solar mountain
potent girder
#

And what about other things that normal checkout has - ```ts
automatic_tax: {
enabled: true
},
invoice_creation: {
enabled: true
},
allow_promotion_codes: true,

#

shipping rate

solar mountain
#

No, none of those are supported

#

They're mostly Checkout exclusive currently

potent girder
#

And prices added in stripe's dashboard?

#

I've prices added with multiple currencies

#

So when user starts checkout from US price is in dollars

#

And when he starts checkout from DE its in euro

solar mountain
#

Nope, you can't use them with Checkout

#

And the price localisation is a Checkout feature

potent girder
#

eh thats bad

#

And would I be able to use it if I used PaymentRequestButton instead of express checkout?

#

I mean all of those above^^

solar mountain
#

No, as I've said. Checkout exclusive

#

Why are you trying to move off of Checkout?

potent girder
#

hah

#

I wish it was my decision 😄

solar mountain
#

Did you look at embedding it on your site as opposed to using the hosted/redirect flow?

potent girder
#

Well thats an option too

#

Okey, thanks for help