#Zhi - Afterpay

1 messages ยท Page 1 of 1 (latest)

red glen
#

Can you send me the ID of the Checkout Session that you used here? Or can you create a new Checkout Session and send me that ID?

#

Afterpay should show up as long as the payment the Checkout Session is for meets AfterPay's requirements

red glen
#

Thank you. Checking in to that

#

It looks like you are explicitly passing in payment_method_types as an array. Can you try adding afterpay_clearpay to the list of payment method types that you are passing in there?

dawn breach
#

I didn't pass any payment methods there

red glen
#

Basically, there are two ways to specify what payment methods you want to show up. You can leave out the payment_method_types param and then Checkout will display all relevant payment methods that you have enabled in your Dashboard. Or, you can specify the payment types like you are doing now with payment_method_types but you need to explicitly add each one that you want to use

#

I see that now. One sec

#

That looks like it should work. Can you try making that call again but specify payment_method_types=['afterpay_clearpay']?

#

That should error out and tell us why this is incompatible

dawn breach
#

checking now

#

error out as you thought:
stripe.error.InvalidRequestError: Request req_iYRLglasJvLxpm: The payment method afterpay_clearpay requires collecting shipping information. Either set shipping_address_collection or provide shipping information via payment_intent_data[shipping].

#

it forces me to add shipping address before the session creation.

#

it shows the shipping address while checking out

#

but it needs the shipping address before creating the checkout session object

red glen
dawn breach
#

does this mean we need to collect shipping address first, then proceed to create checkout session?

#

can we create checkout session first, then collects the shipping address after that?

red glen
#

Yes, you can create the session first and have it collect shipping info after. To do that you can use the parameter that I linked to

dawn breach
#

most of the products in our platform are kind of digital product, which doesn't need the shipping address

#

payment_method_types?

red glen
#

I will look in to how this applies to digital products

dawn breach
#

now I can see the option after applied this shipping_address_collection

#

is it possible to only enable this shipping address collection when selecting Afterpay option?

#

right now, looks like collecting shipping address for all payment types

red glen
#

As far as I can see, it is not possible to only collect the shipping address then.

#

I was not able to find much on the digital products angle. Will consult my colleagues and get back to you with what we find

#

It looks like this is Afterpay's requirement even for digital products. So it looks like there isn't a good way to achieve all parts of your use-case at the moment. You will need to either do one Checkout Session that collects shipping address info for all payments or make separate checkout sessions, one that collects shipping info and one that doesn't

dawn breach
#

it is possible to configure the checkout page not to show shipping address collection for the card and show the shipping address collection for the afterpay?

red glen
#

As far as I know, you can't. The only way to set it for the Checkout Session affects the entire session rather than all payment methods. We do have a way to set things per payment method with Checkout but for afterpay_clearpay it does not have the option to display that. As you noted earlier payment element can optionally display the shipping info fields, but it looks like Checkout can't at the moment. If you need that functionality now, you may need to make your own custom page that uses the payment element.

dawn breach
#

with payment element, how to customize to show/collect shipping address?

#

we couldn't achieve that with payment elements, that's why we are trying the checkout now

#

can you show us example of how to show card and afterpay with payment element way. We don't need shipping address for the card payment type. Only show the shipping address for the afterpay payment type, pleaes?

tacit bramble
#

๐Ÿ‘‹ @red glen has to head out, but I can help - give me a minute to catch up

#

Just to confirm we're on the same page - you're trying to see how Shipping Address can be collected for afterpay with the Payment Element, correct?

dawn breach
#

yes

#

with Payment Element, is it possible to configure card and afterpay options differently?
we only need shipping address collection for the afterpay option

tacit bramble
#

With payment element we'll only collect shipping address if it's required for the payment method type - so we'll automatically attempt to collect a shipping address for afterpay since it's required for that type, but we won't do the same with card

dawn breach
#

how to enable shipping address collection when selected afterpay method (Payment Element)?

#

with testing, it failed to confirmPayment due to missing shipping addresses

#

looks like the addresses field shown on the afterpay is actually billing address