Skip to content
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

AfterPay/ClearPay error - Missing shipping address #263

Closed
philipboomy opened this issue Nov 7, 2023 · 2 comments · Fixed by #274
Closed

AfterPay/ClearPay error - Missing shipping address #263

philipboomy opened this issue Nov 7, 2023 · 2 comments · Fixed by #274
Labels

Comments

@philipboomy
Copy link

Description

When submitting an order where the selected payment method is AfterPay/ClearPay I am getting an error.

Error message
"message": "Missing required param: shipping[address][line1]."
"type": "invalid_request_error"

It may be related to these #257 and #244

Additional info

  • Craft CMS version: 4.5.9
  • Stripe for Craft Commerce version: 4.0.1.1
@nfourtythree
Copy link
Contributor

Hi @philipboomy

Thank you for reporting, we have pushed up a fix for this that has been included in the latest release of the plugin 4.1.0.

The README has been updated with instructions on how to get this all working.

Thanks!

@philipboomy
Copy link
Author

Hi @nfourtythree

I am not sure how this works. According to Stripe the address is recommended to be send when creating the payment intent https://stripe.com/docs/payments/afterpay-clearpay/accept-a-payment?platform=web&ui=API#web-create-payment-intent so my question is has that been done?

Stripe support told me this:
We've checked the information here and we wanted to let you know that Afterpay requires both shipping and billing details to be present for the payment to succeed.

I cannot see where in the readme docs it is solved unless it is being solved via this https://github.com/craftcms/commerce-stripe#order-optional but it mention billing details.

I am using this approach https://craftcms.com/knowledge-base/custom-stripe-commerce-checkout and I am on a 1 page checkout so I can call a function when billing address is submitted and then submitting this

defaultValues: {
              billingDetails: {
                  name: paymentResponse.cart.billingAddress.fullName,
                  email: paymentResponse.cart.email,
                  address: {
                      postal_code: paymentResponse.cart.billingAddress.postalCode
                  }
              }
          }

I tried adding

shippingDetails: {
                    address: {
                        line1: '123 Main St',
                        postal_code: paymentResponse.cart.billingAddress.postalCode
                    }
                }

but still getting the error so not sure what to do. You got it working with passing the shipping details frontend? Stripe "recommends" doing the shipping details from the server but not sure if "recommend" actually means we have to.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants