You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v3 form elements don't work with single page checkouts. It requires a billing_address, and that is set on pageload from the orders existing billing address.
On single page checkout for a new customer, a new billing address is usually built on pageload, but it is not a valid address until the user fills it in - and because v3 form elements loads in the billing address on pageload, it will try to submit an invalid address as the billing address (regardless of what the user filled in), causing validation errors when on payment source creation.
Rather than the payment intent creator just using the payment source address, I think it should first look for the existence of an address in the order params, as that will be more up-to-date, and work with a single page checkout flow.
This is a prepender that fixes this issue on a clients project:
# frozen_string_literal: truemodule[scrubbed_client_namespace]moduleSolidusStripemoduleCreateIntentsPaymentServicemoduleUseAddressParamsForPayment# Usually we have a billing address on the payment source in these# params because it is populated at pageload, however in single# page checkout, this mostly won't be the case. This ensures that# we can use the orders ship_address or bill_address params in that# case.defaddress_attributesifhtml_order_data["use_shipping"] == "1"html_order_data["ship_address_attributes"]elsifhtml_order_data["bill_address_attributes"]html_order_data["bill_address_attributes"]elsesuperendenddefhtml_order_dataifform_data.is_a?(String)data=Rack::Utils.parse_nested_query(form_data)data["order"]else{}endendendendendend
The text was updated successfully, but these errors were encountered:
Some feedback on this from @elia that I think is valuable here:
I wish /stripe/create_intent was accepting a json instead of a serialized form-data string, the fact that this code is coupled to the form structure of the checkout with specific assumption smells really bad.
This issue has been automatically marked as stale because it has not had recent activity. It might be closed if no further activity occurs. Thank you for your contributions.
👋 Hey all!
v3 form elements don't work with single page checkouts. It requires a billing_address, and that is set on pageload from the orders existing billing address.
On single page checkout for a new customer, a new billing address is usually built on pageload, but it is not a valid address until the user fills it in - and because v3 form elements loads in the billing address on pageload, it will try to submit an invalid address as the billing address (regardless of what the user filled in), causing validation errors when on payment source creation.
Rather than the payment intent creator just using the payment source address, I think it should first look for the existence of an address in the order params, as that will be more up-to-date, and work with a single page checkout flow.
This is a prepender that fixes this issue on a clients project:
The text was updated successfully, but these errors were encountered: