craftcms / commerce-stripe

Stripe payment gateway for Craft Commerce
https://plugins.craftcms.com/commerce-stripe
MIT License
31 stars 48 forks source link

AfterPay/ClearPay error - Missing shipping address #263

Closed philipboomy closed 10 months ago

philipboomy commented 1 year ago

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

nfourtythree commented 10 months ago

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 commented 9 months ago

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