-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stripe Payment Element should not ask for country and postcode when the cart already knows them #257
Comments
Any chance you could post the entirety of your stripeParams? I can't get any response from stripe for the life of me except "Invalid payment or order". Almost like it's trying to do a payment on the initial connection to stripe |
I don't think that would really be relevant to this issue - better to ask in Discord, or open a new issue I think. |
I've managed to hide the country and postcode fields by using the following code:
However I then get the following error when trying to submit a payment:
@lukeholder Could you advise the best way to integrate the default data here? We usually like to pass as much of the customer data to Stripe as possible - name, email, address etc. This documentation for Stripe outlines adding a form event listener but not sure how we can do that in this instance: Craft Commerce Stripe documentation has some events to listen to but again not sure if these will do the trick. I've tried playing around with them but can't get past the error I am seeing. |
I will look to allow address to be passed into the payment form. I'll update here once it's ready. |
Yeah passing in the name is important as Stripe uses this in their antifraud when they compare name to email. Right now we are getting a warning/message on all payment that name is missing etc. Any update on this? |
I'll look at this today and let you all know what we come up with. |
@lukeholder Any update or eta on this one? |
We have a potential fix for this in this PR #274 Stay tuned for the merge and release. I will update here once released. |
Well anticipated. Thank you! |
Hi All We have pushed up a fix for this that has been included in the latest release of the plugin The README has been updated with instructions on how to pass the order (cart) to the payment form to get all the new functionality working. Thanks! |
Description
When using
getPaymentFormHtml()
with the new Stripe Payment Element UI, there seems to be no practical way to instruct Stripe to hide and prepopulate its country and postcode fields if Craft's cart already has those details.Steps to reproduce
billingAddress.countryCode
andbillingAddress.postalCode
. Choose UK as billing country.gateway.getPaymentFormHtml(stripeParams)|raw
As a workaround, we can at least prepopulate those values by passing the following parameters to
getPaymentFormHtml
:At a minimum, I would definitely expect Commerce to do that for us automatically, but having full control over Stripe's config would be even better.
This is a problem not only because the customer is confused why we're asking for some of their billing details again, but more importantly, it creates a potential inconsistency between the data we have collected and stored with that which the customer may have submitted in the final payment step. The billing info collected earlier by Commerce may be used in different circumstances, and creates a paper trail and accurate receipts and email notifications for both customer and store admins.
I understand that it's possible to "go manual" by not using
getPaymentFormHtml()
and writing all of our own code from scratch to instantiate the Payment Element, but I'm sure you'd agree that that's quite a significant undertaking, and Commerce already does a good job of getting us 90% of the way there - it's just not quite good enough yet.Additional info
The text was updated successfully, but these errors were encountered: