FROM CACHE - en_header

Unable to checkoutCompleteWithTokenizedPaymentV3 when a "non applicable" discount code is applied to

New Member
11 0 0

TLDR: After adding a discount code who's line items or shipping lines don't fulfill the requirements of that code, polling for successful checkout completion after completing the checkout with the `checkoutCompleteWithTokenizedPaymentV3` mutation never returns a non nil Order object - thus failing the checkout flow

SDK Version: 5.0.0

When the user applies a discount code to the checkout that doesn't apply to any of the line items or shipping lines, for example, a free shipping discount code with a $50 limit but the line items subtotal doesn't meet this limit, after successfully completing the checkout with the `checkoutCompleteWithTokenizedPaymentV3` mutation and then polling for successful checkout completion, the polling fails because the order object is always nil.

Steps to Reproduce
1. Create checkout with `checkoutCreate` mutation
2. Using the `checkoutDiscountCodeApplyV2` mutation add a discount code who's requirements won't be met for via the line items or shipping line
3. Trigger Apple Pay flow
4. Complete checkout with `checkoutCompleteWithTokenizedPaymentV3` mutation. (This returns successfully)
5. Poll for checkout completion using `.node(id: checkoutId) { .onCheckout { $0} }` query, with retry polling condition:

let retry = Graph.RetryHandler<Storefront.QueryRoot>(endurance: infinitePollingEnabled ? .infinite : .finite(10), interval: 1) { (response, error) -> Bool in
return (response?.node as? Storefront.Checkout)?.order == nil

Full Query:

static func query(checkoutId: GraphQL.ID) -> Storefront.QueryRootQuery {
        return Storefront.buildQuery { $0
            .node(id: checkoutId) { $0
                .onCheckout { $0
                    .appliedGiftCards{ $0
                        .amountUsedV2 { $0
                    .shippingLine { $0
                        .priceV2 { $0
                    .order { $0

6. Retry polling uses up all the retries and fails because Storefront.Checkout Object's Order property is always nil.

Trouble Shooting
As soon as I remove this non applicable discount code, the checkout completes successfully and the polling returns with an order object that has a value.

Expected Results
I would expect to still be able to successfully complete a checkout with a non applicable discount code just like how the Shopify checkout web flow allows you to do.

Replies 0 (0)