Open adamknipfer opened 2 months ago
Adding additional information...
I ran the following query against the admin-api
and the correct Shipping amount was returned.
Request:
query GetOrder($id: ID!) { order(id: $id) { ... on Order { id code shipping } } }
Response:
{ "data": { "order": { "id": "18", "code": "AS4NWNQH96CU6NM5", "shipping": 500 } } }
After digging in deeper, I found the root cause of the issue (if it can still be called that...)
If you create the PaymentIntent prior to selecting the Shipping Method, the payment amount will not be updated to account for the update in total cost. My solution was to move the Payment Method logic to later in the checkout flow so the shipping is set prior to the PaymentIntent's creation.
I believe this logic makes sense but there's no documentation stating this behavior so it takes a fair bit of debugging to figure it out. I am going to leave this open in case this helps someone in the future but the bug label can be removed.
Describe the bug When using the StripePlugin following the official guide, the Payment that is created does not include the shipping charges so the Order is stuck in ArrangingPayment. When selecting a Shipping Method without a cost (i.e. $0.00), this issue does not occur.
To Reproduce Steps to reproduce the behavior:
createStripePaymentIntent
) on the server and pass this to the formaddItemToOrder
mutation via your Next.js storefrontsetCustomerForOrder
,setOrderShippingAddress
,setOrderShippingMethod
,setOrderBillingAddress
(I currently have just one basic form collecting all the required fields)confirmPayment
return_url
specified in theconfirmPayment
method in previous stepExpected behavior After
confirmPayment
is called, the customer is charged for the full amount of the order including shipping charges and the Order is moved into the PaymentSettled state so thatorderByCode
query can be called for displaying a confirmation page.Environment (please complete the following information):
Additional context Here's an example. See that the Order still requires additional payment for the amount of the shipping cost, but a payment was made actually settled:
Please let me know if there is additional detail that can be provided!