#birdy247

1 messages ยท Page 1 of 1 (latest)

vague ploverBOT
thick lichen
#

Hi

#

We are using the address element in shipping mode in conjunction with the paymentElement

#

I have noticed that the address is always coming through in the billing address, and not the shipping address

wanton harbor
thick lichen
#

pi_3NPnz3F9NVx519I12HvPRBW5

#

Ahh

#

I think I know what this is

#

Our flow is as follows

#
  1. We create a customer/setupIntent on our platform
  2. We clone the customer and create the payment_intents on the backend (paying multiple stripe accounts)
  3. We then confirm the paymentIntents on the frontend
vague ploverBOT
thick lichen
#

SO in short, the address is attached to a paymentElement which is confirming a setup intent

wanton harbor
#

Correct.

#

Apologies for the delay

#

too many developers asking questions today

#

๐Ÿ™‚

thick lichen
#

I bet!

wanton harbor
#

Does ^that unblock you? Any other queries I can help with?

thick lichen
#

Not really

#

Can we attach the addressElement to each paymentIntent we confirm?

#

using confirmCardPayment

wanton harbor
#

Hang on, let me clarify.

The address is attached to the PaymentMethod created by the SetupIntent

#

When you clone the PaymentMethod to the connected account, the address is cloned along with it

thick lichen
#

Billing Address.. ues

#

yes*

#

shipping address is what we want though

wanton harbor
#

AFAIK It would be cloned to the connected account when you clone the customer

thick lichen
#

We dont clone the customer (sorry got that wrong)

#

We clone the payment method

#

And then create the paymentIntent using the cloned paymentMethod

#

So I think the shipping address is being captured in the addressElement, but we then store this on our customer. Then clone the payment method to the connected account, so the shipping address is lost

#

Any thoughts

#

Can we use the addressElement when confirming the paymentIntent with the cloned paymentMethod?

placid egret
#

Oftentimes with cloning, the customer info needs to be manually copied down by making a customer update call on the connected account's customer object

#

Oh or you can supply that info when creating the customer object if you already have it on the platform account

thick lichen
#

stripe.confirmCardPayment has an option for shipping

#

Can we pass it in here?

placid egret
#

Good catch, yes that should be a place that you can pass those details

thick lichen
#

Can we retrieve this from the address element?

#

.getValue().value.address ?

#

That kind of thing?

placid egret
#

Our docs only seem to show getValue() is that not returning a valid object when you run it in your code?

thick lichen
#

The shipping information on this PaymentIntent can only be set with a publishable key when also providing a payment method. Please try again with a payment method or use your secret key.

#

So looks like we cant just set it on the frontend

placid egret
#

Can you show me your code that you used there? I am surprised that it said you don't also have a PaymentMethod if you are using the card element

thick lichen
#

Its quite complex

#

We create the payment intent on the backend with the cloned payment method

placid egret
#

I more meant the specific call that you get that error from

#

I don't think the cloning before affects that error message

thick lichen
#

const {paymentIntent, error} = await stripeConnectedAccount[element.next_action](element.secret, {
shipping: {
name: this.jwtData ? (this.jwtData.first_name + ' ' + this.jwtData.last_name) : '',
address: this.address
}
});

#

element.next_action = confirmCardPayment

placid egret
#

I think you also need to pass card: cardElement, to use the card details from the card element

thick lichen
#

We can return the ID of the payment method

#

We are using a paymentElement

placid egret
#

The method confirmCardPayment does not work with the Payment Element. We'll need to use confirmPayment. Looking in to how to pass this data

thick lichen
#

Hmm. This has been working fine to date

placid egret
#

In that case, can you try passing card: paymentElement (where paymentElement is the name of the variable for the payment element in your code)

#

Basically, as the error message says, you need to provide a payment method when making that call. To provide that payment method, you need to either pass in an actual PaymentMethod ID to data.payment_method or you need to pass in an element that collects card details to the confirm call tha tyou are making

thick lichen
#

but the paymentElement was used to create the setup intent on our platform

#

so if we use the card:paymentElement method

#

Wont that be the paymentMethod on our account, not theirs?

#

I passed in the cloned payment method and it worked

#

Shipping address is present

placid egret
#

Great to hear that that worked! I think the PaymentElement suggestion came from me being unclear on what was happening on your page.

thick lichen
#

Yea, no worries

#

Its not the easiest to follow processes