Storefront API: Orders not showing up after calling checkoutCompleteWithTokenizedPaymentV3

Sterling_Smith
Excursionist
19 0 6

Am I missing an additional step?  The return Checkout object has an order field that's just "null," and nothing is showing up in my Shopify admin dashboard under orders.  I've followed this documentation very specifically (adjusting to the checkoutCompleteWithTokenizedPaymentV3 endpoint) and still no luck.

 

Any help would be appreciated!

Replies 24 (24)

_JB
Shopify Staff
836 100 222

Hey @Sterling_Smith,

 

There are a few requirements that your app needs before you can use this mutation, this guide shows the V2 mutation but the requirements are the same. Please make sure your app has filled these requirements before trying that mutation.

 

If that looks good, can you kindly provide more information about the response you're seeing when you send this mutation? Ideally, if you can provide the X-Request-ID from the response header I can use that to pin-point your request in our logs.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Sterling_Smith
Excursionist
19 0 6

Hi, thanks for the response

 

It looks like we have payments set up as according to that documentation, so here is our x-request-id header: f39dd67b-cef9-46c5-b99a-c44f549f092c

 

It looks like even though a legitimate credit card was provided, the response object includes a payment object that looks like:

 

 

"payment": {
  "id": "Z2lkOi8vc2hvcGlmeS9QYXltZW50LzE0OTU4MTUxMjcwODk/Y2hlY2tvdXQ9NmJiMzVkMTVmYWI5ZTRjYmJmMWIxN2I0MGFkOGZmMDUma2V5PWNhOGIyZjU5NjAxM2NlOWIzNzUxYmIyYzhkMzliNTBi",
  "test": false,
  "ready": false,
  "errorMessage": null,
  "transaction": null,
  "nextActionUrl": null,
  "creditCard": null
},

the card provided was tokenized via Shopify, using the 

https://elb.deposit.shopifycs.com/sessions

endpoint

 

Sterling_Smith
Excursionist
19 0 6

Hello there,

 

We've made some progress and are now seeing this error in our store when attempting to complete and pay for a checkout order

Screen Shot 2020-05-13 at 12.35.42 PM.png

 

With not much to go on, is there anything you would suggest we try?

daniel_sonny
Excursionist
12 0 4

Hello. I'm facing the same issue but with a Apple Pay payment token.

 

Basically, We manage to create a checkout, fill it with items but the checkoutCompleteWithTokenizedPaymentV3 doens't return a "order" and neither a error in "checkoutUserErrors" field once we call the mutation to complete the checkout.

 

Is there a way to debug the issue? is there a log registry we can check to understand the issue.

 

More over the documentation seems a clunky and misses of what data we should send from the Apple pay response that we get from the Swift native feature with PassKit.

Sterling_Smith
Excursionist
19 0 6

Yep!  This same thing is also happening to us with an Apple Pay token as well

daniel_sonny
Excursionist
12 0 4

Hey mate @Sterling_Smith. How did you mange to get at least an error in their dashboard for the current checkout? Our Checkouts we do programmatically are just displayed in the "abandoned" section.

 

The situation with this mutation seems a bit messy to me.

lukasz_gj
Visitor
1 0 0

I am facing with the same issue.
Do you know if it is a temporary problem?
I would like to proceed with implementation.

@Sterling_Smith how you managed to see errors?

Sterling_Smith
Excursionist
19 0 6

The error we are now seeing is still located in the Abandoned Checkouts section of our dashboard, when we click on one of the checkouts in the list, it shows up at the bottom.

 

We were able to get this far by ensuring that everything related to accepting payments in the store (not the app, but the store we were trying to place orders with) was set up properly (Settings -> Payments), but that new error is still there

daniel_sonny
Excursionist
12 0 4

@Sterling_Smith Ok, basically is what we have now. I mean the Abandoned checkouts section full of our tries, but without errors you see.

 

@_JB Could you please address us?

_JB
Shopify Staff
836 100 222

Hello all,

 

Looking in to this as we speak. If possible, please provide the X-Request-ID from a response with an empty payment object, and I can use this to find the request in our logs and get more information from there.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

_JB
Shopify Staff
836 100 222

@Sterling_Smith @daniel_sonny @lukasz_gj,

 

Can you confirm if you're processing real or test payments on these checkouts? I'm seeing some errors in our logs related to the vaulted card, but we aren't able to see much in our logs when it comes to payments so any clarification you can provide will be helpful.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

daniel_sonny
Excursionist
12 0 4

@_JB thanks for you help. Tomorrow I'll provide you some requests ids.

 

In the meantime, we are trying with real translations on Apple pay on our app. For sure we missed something, but we don't really able to understand what is missing in our config.

 

What I really don't understand is why you don't return an error on mutation execution and it would be good to have a events log as Stripe has, for example.

 

Sterling_Smith
Excursionist
19 0 6

Thank you for the response @_JB 

 

The request header is: 

"x-request-id":"3889712b-591f-414f-bbc5-9679ec99c67d",

 

I know that the store's payment processing has not be set to test mode, and for whatever reason when trying to tokenize a credit card in the vault using the "test" parameter, it returns an error saying that test cards are not available.  We are trying to use a real credit card.

daniel_sonny
Excursionist
12 0 4

We manage to fix this issue by sending the entire JSON returned by Apple Pay Native sdk to checkoutCompleteWithTokenizedPaymentV3, and not just the payment token.

 

Nice, but my suggestions still:

  1. add more info in the documentation on how to use your API with ApplePay and GooglePay.
  2. add errors to understand what happened.
Sterling_Smith
Excursionist
19 0 6

Hi @daniel_sonny do you think you could provide the format of the request you're sending to the checkoutCompleteWithTokenizedPaymentV3 endpoint?  Minus any sensitive info of course.  I just want to be sure since I think we're using different SDKs to retrieve the apple pay token but both attempting to use it for the same purpose.

 

@_JB any further insight based on the provided info would be really appreciated, this is a bit urgent as it's affecting our live app

daniel_sonny
Excursionist
12 0 4

This is the mutation we use following the specs of their (GraphQL) mutations:

export const checkoutCompleteWithTokenizedPaymentV3 = `mutation checkoutCompleteWithTokenizedPaymentV3(
  $checkoutId: String
  $payment: TokenizedPaymentInputV3!
) {
  checkoutCompleteWithTokenizedPaymentV3(
    checkoutId: $checkoutId
    payment: $payment
  ) {
    checkout {
      id
      webUrl
      subtotalPriceV2 {
        amount
      }
      availableShippingRates {
        ready
        shippingRates {
          handle
          priceV2 {
            amount
          }
          title
        }
      }
      shippingLine {
        priceV2 {
          amount
        }
      }
      lineItems(first: 20) {
        edges {
          node {
            id
            title
            quantity
          }
        }
      }
      orderStatusUrl
      order {
        name
        email
        orderNumber
        financialStatus
        fulfillmentStatus
        currentTotalPrice {
          amount
        }
        subtotalPriceV2 {
          amount
        }
        cancelReason
      }
    }
    checkoutUserErrors {
      code
      field
      message
    }
    payment {
      id
      amountV2 {
        amount
      }
      ready
      test
      transaction {
        amountV2 {
          amount
        }
        kind
        statusV2
        test
      }
    }
  }
}
`

Where TokenizedPaymentInputV3 is

const payment: TokenizedPaymentInputV3 = {
      paymentAmount: {
        amount: paymentAmount.amount,
        currencyCode,
      },
      idempotencyKey: ....,
      billingAddress: shippingAddress,
      type,
      paymentData: String,
    };

where paymentToken is the String (an escaped JSON) provided by native Apple pay mobile SDK (PassKit).

 

I hope this could be helpful for you.

Sterling_Smith
Excursionist
19 0 6

@daniel_sonny thanks for the response.  Unfortunately it seems like escaping the JSON response that we're getting (using React-Native-Payments) doesn't cause the payment to be accepted or orders to show up.

 

Just to be clear, are you still experiencing trouble when trying to check out with a vaulted credit card?  Were you only able to solve this for Apple Pay?

 

Thanks!

_JB
Shopify Staff
836 100 222

Hey @Sterling_Smith,

 

So far I haven't been able to replicate the behaviour you've described. I have an app setup on my test store with the same scopes as your app, but the  checkoutCompleteWithTokenizedPaymentV3mutation works for me as expected. I'm hoping you can confirm a few more things: 

 

-The test shop you're using currently has the storefront password enabled, can you confirm that you're disabling the storefront password on that shop before testing?

 

-Can you confirm if you're seeing the same error when using the V2 versions of the mutations?

 

As well, I'd like to ask that you try your tests again by enabling "test mode" on your test shop's gateway. With test mode enabled, you can send through  4012 8888 8888 1881as the credit card number, any year/month combo in the future, and any 3 digit CVV code. This will prevent you from needing to use a real card for testing, and will help rule out any issues with the card as being related to the issue.

 

Please let me know about the above, and don't hesitate to reach out if there are any questions.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Sterling_Smith
Excursionist
19 0 6

Hi @_JB 

 

Thanks for your response.  We've disabled password protection on the store in question, as well as set payments to test mode.  We used a test card, but it still wasn't working, so I thought to combine the advice given by @daniel_sonny and see if I could pass the escaped JSON that was returned from the Shopify Card Vault as the paymentData parameter.  Still no dice, but I did receive the same error (see this post from earlier) in the Abandoned Checkouts control panel, just like before.  So I'm thinking it has something to do with the paymentData parameter, since I seem to get that error with either way I proved the vault id.

 

Can you reassure me that I'm doing this correctly?  My order of operations is as follows:

 

- A user enters their credit card data into a form field in our app.

- We send that form data to 'https://elb.deposit.shopifycs.com/sessions' and receive an ID from the Shopify Card Vault as a JSON response (formatted like '{"id":"idstringgoeshere"}') 

- That ID is then provided as an input object (as part of a TokenizedPaymentInputV3) on a mutation of checkoutCompleteWithTokenizedPaymentV3 using the Storefront API

 

If something in the mutation wasn't formatted correctly it would usually return an error, we've seen errors like this in the past.  But everything does seem to go through fine, no errors are returned from the mutation request.  It's only when we check the Abandoned Checkouts that we see there was an issue.

 

The x-request-id of the latest request we made is: "ec233e51-dccf-4ff0-ac22-ad32d2ae9d51"

 

Could we be formatting something wrong in the TokenizedPaymentInputV3?

Sterling_Smith
Excursionist
19 0 6

Hi @_JB 

 

I think my previous reply got marked as spam.  We tried those suggestions to no success.  I even tried including the paymentData as an escaped JSON object with data coming directly from Shopify's Card Vault but no luck.  The interesting thing is that there's no error being returned by the storefront API, it's only when we look at the store's Abandoned Checkouts list that it shows the error (the same error from earlier, the one in this thread posted on 5-13-20)

 

Could it be we are formatting something in the request wrong?  Usually when we have formatting issues in the request, the API tells us.  And before we we using test cards, when attempting to use an invalid live card, the API would also throw back an error.

 

The x-request-id of the most recent request where we tried this is "ec233e51-dccf-4ff0-ac22-ad32d2ae9d51"

 

Does the request look good?  Is there anything formatted wrong?  We are using the Shopify Card Vault located at 

https://elb.deposit.shopifycs.com/sessions

to tokenize our cards.  Is this correct?  Should we be using something else?  The Storefront API docs are a bit lacking and this endpoint comes from the Checkouts API docs but I was presuming it would work all the same, perhaps not?

 

Thanks!

_JB
Shopify Staff
836 100 222

Hey @Sterling_Smith,

 

The endpoint for vaulting a card is the same for admin and storefront API, they both use the REST endpoint.

 

It's possible that the request is failing due to formatting issues, though as you mentioned I would expect the API to return an error in that case. My access to logs related to payment data is very limited, so I'm not able to see your actual request in the logs. I'm going to DM you some credentials and ask that you try the request on my test shop, which should tell us if the issue is with your request or something to do with the app/shop.

JB | Solutions Engineer @ Shopify 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

Sterling_Smith
Excursionist
19 0 6

Hi @_JB

 

Thank you so much for your DM.  Using the info you provided, we solved our problem!

 

For everyone watching this thread, what we ended up needing to do was make sure our request to the Shopify Card Vault included both the amount field and unique_token field.  After switching it to that, it STILL didn't work, but we then reverted the endpoint to the V2 endpoint and it worked like a charm

 

To paste a bit of the stuff that @_JB sent me:

 

The vault card request should look like:

 

{
"payment": {
"amount": "10",
"unique_token": "my-client-generated-idempotency-token",
"credit_card":{
"number": "4012888888881881",
"month": "12",
"year": "2020",
"verification_value": "123",
"first_name":"John",
"last_name":"Smith"
}
}}

and the variables passed to the mutation on checkoutCompleteWithCreditCardV2 (not checkoutCompleteWithTokenizedPaymentV3) should look like this:

{
"checkoutId": "Z2lkOi8vc2hvcGlmeS9DaGVja291dC80ODhhMjgyMDhlZTBhMzk3YmU2YTg0OTIzNDJjYWEwYT9rZXk9NjE5MGIyZTU3NjBmMzhlNmE2NmFhOTcwNTg0NzU4Mzk=",
"payment": {
"paymentAmount": {
"amount": "10",
"currencyCode": "USD"
},
"idempotencyKey": "my-client-generated-idempotency-token11",
"billingAddress": {
"firstName": "John",
"lastName": "Doe",
"address1": "123 Test Street",
"province": "Quebec",
"country": "Canada",
"city": "Montreal",
"zip": "H3K0X2"
},
"vaultId": "the id you got from the vault request"
}
}

 

I hope this can help someone else too.  Thank you again @_JB for the excellent support!

taylor_bf
Shopify Partner
2 0 3

HI @_JB ,

I am facing the same issue and followed all the steps mentioned above. Could you please help me here.

X-Request-ID : 34c29a36-ee1f-458a-8ddd-e4ed51a47c25 (using checkoutCompleteWithCreditCardV2)

X-Request-ID : 801a5652-c690-4aad-ab9c-8e09e6c635c3 (using checkoutCompleteWithTokenizedPaymentV3)

Ours is a Webapp and I have already requested for  Custom Storefront Payment Processing Request here 

Is that the cause for errors? I have tried both using CreditCardV2 and TokenizedPaymentV3.

With CreditCardV2 it is always throwing accessdenied error 

and with TokenizedPaymentV3 there are no error but when i poll for payment it comes like below. Somehow the creditcard is not captured, which makes me doubt whether the scope "write_checkouts_payments" is what is missing to our app?

{
    "data": {
        "node": {
            "id": "Z2lkOi8vc2hvcGlmeS9QYXltZW50LzE5MTcwNTU5OTE5NTg/Y2hlY2tvdXQ9NDMyODM1ZWExMDJkMzgzM2ZkMzU3MzlhNTFjMjUzYTEma2V5PTZmYzM2ZGU0MTAyMThiZjhjMjhiMjYxZTU4NzYwNTFi",
            "idempotencyKey": "347049305",
            "checkout": {
                "id": "Z2lkOi8vc2hvcGlmeS9DaGVja291dC80MzI4MzVlYTEwMmQzODMzZmQzNTczOWE1MWMyNTNhMT9rZXk9NmZjMzZkZTQxMDIxOGJmOGMyOGIyNjFlNTg3NjA1MWI="
            },
            "ready": true,
            "nextActionUrl": null,
            "test": true,
            "errorMessage": "There was an issue processing your payment. Try again or use a different payment method.",
            "amountV2": {
                "amount": "60.08"
            },
            "creditCard": null,
            "transaction": {
                "statusV2": "ERROR",
                "kind": "SALE",
                "test": false,
                "amountV2": {
                    "amount": "60.08"
                }
            }
        }
    }
}

 

 

Thanks,

Taylor.

 

 

SethT
Shopify Partner
5 0 0

Would you be able to share the code you used to access this endpoint? I get a 422 Unprocessable Entity Error whenever I try to use it.