Apple Pay Discount gets invalidated

New Member
2 0 0



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 :


"allocation_method": "across",
"customer_selection": "all",
"once_per_customer": True,
"target_selection": "all",
"target_type": "line_item",
"value": str(amount),
"value_type": "fixed_amount
"starts_at": start_date,
"title": disc_code


Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 124

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 

New Member
2 0 0
So far we resolved it by recreating the checkout and the discount code and reapplying it, when the user taps cancel on the apple pay form. Not the most optimal, but it works.
If you try to reapply the same code to the checkout it throws a CheckoutError.
Will keep an eye on the changelog.

Thanks for the reply.