Open robzor opened 1 year ago
Thanks for sharing, let me see if I can recreate the problem, first. I'll come back to you if we need anything else.
Hi @alexjcollins sorry to nag, did you have any luck with this?
I haven't been able to replicate this on our local environment. I suspect that it's to do with your Countries & States settings (/commerce/store-settings/countries
). The error suggests the country code for the billing address is being sent as null
.
Before you hit the pay
button, what does the cart look like in the Craft admin? Can you share a screenshot?
Hi @alexjcollins , the site only ships to the UK and we actually set this in our address fields in the checkout as well with:
{{ hiddenInput('countryCode', "GB") }}
Here's a screenshot of the cart:
We also have this in our Store Settings:
I am experiencing the same issue while trying to integrate this plugin for the first time.
I have arrived at an understanding of what is causing the (my) issue. After the payment is submitted to Stripe a request is submitted to the endpoint /actions/web-payments/stripe/pay
containing a token from Stripe in the payload. Below is an example from my test environment.
This includes an object "billing_details" which is utilised to set the order billing address if it's available initially:
As you can see from the screenshot the token from Stripe contains null
for the country where the country code could be. Hence the error Cannot assign null to property craft\\elements\\Address::$countryCode of type string
.
Perhaps the above line needs to be amended or added to with an additional validation check, because whilst all the properties of the billing_details
object are null
this will not cause empty()
to return true
.
Is there any update on this? We are experiencing the same issue only when Apple Pay gets used.
Just to chip in that this seems to be the cause of an issue we are experiencing on completing web payments. Has anyone got this working with Craft/Craft Commerce 4?
Cole
Just to chip in that this seems to be the cause of an issue we are experiencing on completing web payments. Has anyone got this working with Craft/Craft Commerce 4?
Cole
We weren't able to fix the issue using this plugin without editing the source code. Our solution is to use the commerce-stripe gateway directly and implement the express checkout element from Stripe (https://docs.stripe.com/elements/express-checkout-element).
Unfortunately, commerce-stripe has no option for using the express checkout element, so it needs to be implemented on your own. But I think using the express checkout element is the future way of doing this. I also made a thread on the commerce-stripe github page: https://github.com/craftcms/commerce-stripe/discussions/286
Hi there, I'm getting a 500 error when trying to use the plugin, the pay popup will show but when I click 'Pay' I get the error.
I'm running Craft Pro 4.4.12 and Commerce 4.2.8, and this is on OSX Desktop in Chrome:
Template code:
500 error in console:
If you need any more information please let me know! Thanks!