#tomb_checkout-overwrite-customer-address

1 messages ยท Page 1 of 1 (latest)

glacial pineBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1437515373875560518

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

manic ferry
#

Before, loading the checkout page, in both the billing details and the shipping details were similar. Once the checkout payment is selected, only the country code remains

final scarab
#

Sorry but the screenshot doesn't provide sufficient context here.

#

Can you share an example Customer ID where you expect to see these details but don't?

manic ferry
#

So my main question is:
If the shipping address is connected to the payment method, it doesn't make sense to ask the the customer for their billing details in our own application as Stripe requires it during the checkout session

#

cus_TOndUf2oYIPy9n

final scarab
#

Billing addresses are saved to the Payment Method, not the Customer

#

Shipping address is saved to the Customer

#

I think the main reason you might want to collect addresses in your own system is that Stripe dynamically determines how much information to collect based on the Customer country & payment method type.

#

Some payment methods require the full billing address but others don't.

manic ferry
# final scarab Billing addresses are saved to the Payment Method, not the Customer

The code I use during creation of the customer:

$data = [
'name' => $company->name,
'business_name' => $company->name,
'email' => $company->billing_email ?? $company->email,
'description' => $company->subtitle,
'phone' => $company->phone,
'address' => [
'line1' => $billing ? $company->billing_address : $company->address,
'city' => $billing ? $company->billing_city : $company->city,
'postal_code' => $billing ? $company->billing_postalcode : $company->postalcode,
'country' => $billing ? $company->billing_country : $company->country,
'state' => $billing ? $company->billing_state : $company->state,
],
'shipping' => [
'name' => $company->name,
'phone' => $company->phone,
'address' => [
'line1' => $billing ? $company->billing_address : $company->address,
'city' => $billing ? $company->billing_city : $company->city,
'postal_code' => $billing ? $company->billing_postalcode : $company->postalcode,
'country' => $billing ? $company->billing_country : $company->country,
'state' => $billing ? $company->billing_state : $company->state,
],
],
'tax' => [
'validate_location' => 'immediately',
],
];

Stripe Dashboard puts that information both under Billing details (Facturatiegegevens as translation and Shipping details (Verzendgegevens in the picture)

#

As Stripe does NOT ask for any addresses in the checkout, why does it remove the Billing details on the customer model?

final scarab
#

Both addresses are still present on the Customer object

#

I cannot speak to why the display on the Dashboard changes

manic ferry
#

Also in the 'edit customer' popup, all details are gone, but the country

#

While the shipping details remain the same

final scarab
#

We focus on Stripe APIs and product behaviors (Payment Element, Express Checkout Element, etc).

If you retrieve the Customer via the API, do you see missing data?

#

I cannot speak to the Dashboard issues

manic ferry
final scarab
#

Can you retrieve it via the API?

#

Ah, wait I see it now. address only includes country: NL

#

But shipping.address has the full details

manic ferry
final scarab
#

Let me examine the customer.updated events associated with this object

manic ferry
#

So something inside the checkout removes all address details

final scarab
#

Alright, I found the event where this occurs. You can see in the previous_attributes that the full address was present but is unset here.

manic ferry
#

Sorry, the translation on the dashboard is a bit confusing:

It says Billingdetails in dutch, but the Customer->address attributes are shown;
If I manually update the address fields, it updates in the dashboard and in the API Customer retrieve; so the 'address' parameters are translated to billingdetails here

manic ferry
final scarab
#

That seems like a bug to me. Let me try to reproduce on my end

final scarab
#

Okay I can confirm I see the same thing. I do see one option in your Checkout session that might be impacting this.

proven elbow
#

No

final scarab
#

@manic ferry is this individual involved in your deployment?

#

Okay I do think this is still a bug and I will file with the team. However, there is a way around it for you. In your Checkout Session creation request, you specify customer_update.address: "auto". If you remove this, the customer's address will not get reset to just the country when confirming the Checkout Session.

glacial pineBOT
#

@proven elbow looks like you're in the wrong place, this thread is for someone else's question.

Note that posting inappropriate messages in other people's threads is against the rules. No worries if this was just an honest mistake, but anyone who violates the rules multiple times will be removed from this server.

manic ferry
#

So that has to be set in:

$checkout = $company->newSubscription('main', $price->id)
->allowPromotionCodes()
->checkout([
'automatic_tax' => ['enabled' => true],
'success_url' => route('checkout.step', ['step' => 'confirmation']),
'cancel_url' => route('checkout.step', ['step' => 'payment']),
]);

In your request log, I do see:

"customer_update": {
"address":
"auto",
"name":
"auto",
},

How do I manually remove this from the checkout API request?

final scarab
#

It's your code that generates all the parameters for that API request

#

Unless this is something the laravel cashier package is doing for you

#

But the parameter is here

manic ferry
#

Aah I see, I have to set it to never

#

Thanks a lot! I will test this out

final scarab
#

Okay perfect, that should prevent the Checkout session from overwriting the address details you have set

#

Happy to shed what ๐Ÿ’ก I can ๐Ÿ™‚

manic ferry
#

Perfect! Good to hear it was a bug, I couldn't find anything on the internet about people that had issues with this; but thanks a lot!

final scarab
#

I will flag internally. The problem is that the Checkout UI collects the minimum amount of the billing address for confirmation. In this case it only required the country. And since the session params had customer_update.country: "auto", it was automatically updating the Customer.address with that value

#

In cases where you are already collecting that info, you don't want to update the values in the Checkout Session

glacial pineBOT