checkout object not updated: completedAt, orderStatusUrl, order

Robert_Keene
New Member
3 0 0

I have created tests to confirm an order has been made; I am new to graphql;

Step 1 [Successful]: I use a 'checkoutCreate' mutation to create a new order of a product in my shop (keenedom.myshopify.com - Storefront access token: 86ee0b08a1a5a38ee7e7f73af809b1dd):

{
    "data": {
        "checkoutCreate": {
            "checkout": {
                "id": "Z2lkOi8vc2hvcGlmeS9DaGVja291dC8yNTU0NjI1MzEyYmFlZjVkMzU1MjJmYTZmZDA1ZWNjMz9rZXk9Y2Q0NTg4MmE3MTU2ODg3N2ZjYzVhM2U3MDNiN2U1MWM=",
                "webUrl": "https:\/\/keenedom.myshopify.com\/23078417\/checkouts\/2554625312baef5d35522fa6fd05ecc3?key=cd45882a71568877fcc5a3e703b7e51c",
                "completedAt": null,
                "lineItems": {
                    "edges": [{
                        "node": {
                            "title": "#MiddleEarthQuest Donation",
                            "quantity": 1
                        }
                    }]
                }
            }
        }
    }
}

Step 1b [Successful]: I navigate to the checkout URL: "https://keenedom.myshopify.com/23078417/checkouts/2554625312baef5d35522fa6fd05ecc3?key=cd45882a71568... and complete the purchase by logging into a user account I already have setup: Order #1007 Thank you Robert!

Step 2 [Failure]: I use a query to lookup the checkout object, and I have it report fields that should exist if an order is completed: completedAt, orderStatusUrl, and order{ id }.  It returns, but all of the fields are null as if I did not successfully complete the checkout.  I can see that the id and webUrl match the checkout object returned during Step 1.

{
    "data": {
        "node": {
            "id": "Z2lkOi8vc2hvcGlmeS9DaGVja291dC8yNTU0NjI1MzEyYmFlZjVkMzU1MjJmYTZmZDA1ZWNjMz9rZXk9Y2Q0NTg4MmE3MTU2ODg3N2ZjYzVhM2U3MDNiN2U1MWM=",
            "webUrl": "https:\/\/keenedom.myshopify.com\/23078417\/checkouts\/2554625312baef5d35522fa6fd05ecc3?key=cd45882a71568877fcc5a3e703b7e51c",
            "completedAt": null,
            "orderStatusUrl": null,
            "order": null
        }
    }
}

I just need to know when an order has been succesfully completed so I can update my local application to give a user credit for the purchase.

Again I am new to using this API; any advice would be helpful, thanks,

Nathan Keene

Replies 4 (4)
Max
Shopify Staff
Shopify Staff
583 19 88

Hi, Robert.

This is Max from the Shopify Team. 

I've checked in with our checkout Developers and the checkout that returns `null` for `completed_at` flow looks like it was never completed. 

To get some help with this issue from the community, you'd want to share not only the results of your GraphQL queries, but the queries themselves. Without that added info it's hard to deduce exactly where a mistake has been made. 

Hopefully, through sharing that detail, you'll get someone to reply here who has a bit of time to review your work!

Cheers, 
Max
support@shopify.com

Max | Social Care @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

Robert_Keene
New Member
3 0 0

Ok; I've reproduce the entire flow (Test) from scatch.  I got the same results as before ... I included the URLs I encountered as I did the purchase this time. [I see the problem is related to logging in; I've left my notes as-is though - could you please explain if there is a way to track the checkout if the user uses the LOGIN link?!  I have disabled login, assuming there is likely no good solution]

I lookup the product variant:

query {
  shop{
    products(first: 2) {
      edges {
        node {
          variants(first: 2) {
            edges {
              node {
                id
              }
            }
          }
        }
      }
    }
  }
}

The Response:
{"data":{"shop":{"products":{"edges":[{"node":{"variants":{"edges":[{"node":{"id":"Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8xMjI0MzI1NjM0NDY4MA=="}}]}}}]}}}}

I create the checkout using the id:
mutation {
  checkoutCreate(input: {
    lineItems: [{ variantId: "Z2lkOi8vc2hvcGlmeS9Qcm9kdWN0VmFyaWFudC8xMjI0MzI1NjM0NDY4MA==", quantity: 1 }]
  }) {
    checkout {
       id
       webUrl
       completedAt
       lineItems(first: 5) {
         edges {
           node {
             title
             quantity
           }
         }
       }
    }
  }
}

The Response:
{"data":{"checkoutCreate":{"checkout":{"id":"Z2lkOi8vc2hvcGlmeS9DaGVja291dC8yODA1MWMwMTJhMTgzZDBjNzAyMGFiMTkxZWFlZDJmMz9rZXk9Nzg4ZjQ0MmU5MzI5ZTM3NzNlZmQ3NDRjYjQ0NDAxMDE=","webUrl":"https:\/\/keenedom.myshopify.com\/23078417\/checkouts\/28051c012a183d0c7020ab191eaed2f3?key=788f442e9329e3773efd744cb4440101","completedAt":null,"lineItems":{"edges":[{"node":{"title":"#MiddleEarthQuest Donation","quantity":1}}]}}}}}

I navigate to the webUrl provided:

https://keenedom.myshopify.com/23078417/checkouts/28051c012a183d0c7020ab191eaed2f3?key=788f442e9329e...

I LOGIN to do the purchase using an existing account and the url I'm redirected back to is [this is the problem]:

https://www.keenedom.com/23078417/checkouts/df1614179da7133d09f900d91833c2a9?no_cookies_from_redirec...

I select the billing and advance to this URL:

https://www.keenedom.com/23078417/checkouts/df1614179da7133d09f900d91833c2a9?previous_step=contact_i...

I review the purchase information at this URL:

https://www.keenedom.com/23078417/checkouts/df1614179da7133d09f900d91833c2a9?previous_step=payment_m...

Then, I authorize the purchase and end up at this URL:

https://www.keenedom.com/23078417/checkouts/df1614179da7133d09f900d91833c2a9/thank_you

Then I try to find the results by running another GraphQL query using the checkout Id that was returned earlier:

query {
  node(id:"Z2lkOi8vc2hvcGlmeS9DaGVja291dC8yODA1MWMwMTJhMTgzZDBjNzAyMGFiMTkxZWFlZDJmMz9rZXk9Nzg4ZjQ0MmU5MzI5ZTM3NzNlZmQ3NDRjYjQ0NDAxMDE=" ) {
    ... on Checkout {
      id
      webUrl
      completedAt
      orderStatusUrl
      order{
        id
      }
    }
  }
}

The response:
{"data":{"node":{"id":"Z2lkOi8vc2hvcGlmeS9DaGVja291dC8yODA1MWMwMTJhMTgzZDBjNzAyMGFiMTkxZWFlZDJmMz9rZXk9Nzg4ZjQ0MmU5MzI5ZTM3NzNlZmQ3NDRjYjQ0NDAxMDE=","webUrl":"https:\/\/keenedom.myshopify.com\/23078417\/checkouts\/28051c012a183d0c7020ab191eaed2f3?key=788f442e9329e3773efd744cb4440101","completedAt":null,"orderStatusUrl":null,"order":null}}}

 

Again, the problem is when I login to an existing account; the redirect back after logging in seems to have change the checkout.  [I have done a test that confirms this - see below].

Thanks,

R. Nathan Keene

 

I completed a checkout without doing a LOGIN ... and this time the URL didn't change the checkout information:

https://keenedom.myshopify.com/23078417/checkouts/28051c012a183d0c7020ab191eaed2f3

When I rerun the Query to see the checkout I see things WORKING:

{"data":{"node":{"id":"Z2lkOi8vc2hvcGlmeS9DaGVja291dC8yODA1MWMwMTJhMTgzZDBjNzAyMGFiMTkxZWFlZDJmMz9rZXk9Nzg4ZjQ0MmU5MzI5ZTM3NzNlZmQ3NDRjYjQ0NDAxMDE=","webUrl":"https:\/\/keenedom.myshopify.com\/23078417\/checkouts\/28051c012a183d0c7020ab191eaed2f3?key=788f442e9329e3773efd744cb4440101","completedAt":"2018-07-04T02:47:20Z","orderStatusUrl":"https:\/\/keenedom.myshopify.com\/23078417\/checkouts\/28051c012a183d0c7020ab191eaed2f3\/thank_you?key=788f442e9329e3773efd744cb4440101","order":{"id":"Z2lkOi8vc2hvcGlmeS9PcmRlci81MTU1MzA4ODMxNzY\/a2V5PTQ1NjJhMzVmMWFiNzJhYzFkNWM1ZGYyY2ViODA1MDFl"}}}

 

I'll disable the login using the information I found here: https://ecommerce.shopify.com/c/shopify-discussion/t/need-to-remove-sign-in-link-from-main-menu-debu...

matej494
New Member
1 0 0

Hello,

were you able to sort out this issue?

I was experiencing almost the same issue, except it did not work if I didn't login. 

I succeeded to fix this simply by using SFSafariViewController instead of WKWebView for web checkout.
I know they say in the guide to use Safari, but I was trying to reuse our custom ViewController with custom appearance. 

Hope this helps someone.

Best,
Matej