I am able to pay with apple pay, I am able to apply a discount to the order and pay, but I have an issue when ever I apply a discount start the apple pay flow and tap "Cancel" on the apple pay modal.
The discount code gets invalidated, If I try to pay again (Web or ApplePay), discount amount is not allocated to the total.
I get this message when I try to pay with web checkout, after I canceled an order with discount through apple pay
"MY_DISCOUNT_CODE discount code isn’t valid for the items in your cart".
MY_DISCOUNT_CODE is the code discount code that I applied to the order.
I apply the discount code with `.checkoutDiscountCodeApplyV2` mutation.
If I try the to only with web checkout I do not have this issue, I can close and open the webUrl from the iPhone from computer browser, I do not get the code invalidated, I can open the apple pay flow and the discount is applied.
My discount creation payload on the BE is :
Hey @ZZgg8UhrpIkf ,
The behaviour you are seeing is a known use case.
In a nutshell, discount codes are only available for one checkout. And in the case of non-Shopify express checkouts (e.g. Google Pay, Paypal, Amazon Pay, etc) once the session (i.e. window) is closed that checkout is considered closed, so by closing the session, modifying the cart, and then opening up a new session that would technically create a second checkout. So from a technical perspective this would explain why on the first time the customer opens the non-Shopify express checkout they will see the correctly discounted price, but when they close their session to go modify their cart and open the checkout type again the discount code will no longer be available and the original price will be used.
In this use case, the way to avoid this issue would be re-applying the discount code in between the customer closing the non-Shopify express checkout session initially and opening the new checkout. However this is not the most ideal experience, and there is an open ticket in our queue to improve this. I would keep an eye out on our changelog:
Hassain | Developer Support Specialist @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution