Solved

Cannot complete a checkout without requiring payment

jg_va
Shopify Partner
11 0 1

I am trying to complete a checkout without requiring payment. It is document in the Checkout API here: https://shopify.dev/docs/admin-api/rest/reference/sales-channels/checkout?api[version]=2020-04#compl...

 

I have successfully created a valid checkout using the checkout API. I then send the following request to complete the checkout:

 

Request:

POST: https://my-shopify-store.myshopify.com/admin/api/2020-04/checkouts/my-checkout-token/complete.json


Body:

 

{
}

 
At this point I am expecting an unpaid order to be created. However we get the following 422 response:

 

{
    "errors": {
        "base": [
            {
                "code": "missing_transactions",
                "message": "Cannot complete the checkout without any transactions.",
                "options": {}
            }
        ]
    }
}

 

This is slightly confusing as there should be no transaction as we do not require payment in order to create this checkout.

 

It would be great if anyone can shed some light on this.

 

Thanks,

 

Josh

Accepted Solution (1)

_JB
Shopify Staff
836 100 222

This is an accepted solution.

Hey @jg_va,

 

You can complete a free checkout by sending the following POST request:

 

POST /admin/checkouts/#{checkout_token}/complete.json 

{
"checkout": {
"token": "#{checkout_token}",
"order": null
}
}

More details can be found in our Checkout API tutorial here.

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

View solution in original post

Replies 2 (2)

_JB
Shopify Staff
836 100 222

This is an accepted solution.

Hey @jg_va,

 

You can complete a free checkout by sending the following POST request:

 

POST /admin/checkouts/#{checkout_token}/complete.json 

{
"checkout": {
"token": "#{checkout_token}",
"order": null
}
}

More details can be found in our Checkout API tutorial here.

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

lbdev
Visitor
2 0 1

@_JB  We are doing exactly the same thing and still get the same error even after implementing your change. Has the api changed recently ?

We are a Sales Channel App using Checkout API. We are creating a checkout with email, variantid and shipping address and have the shipping_line set. We are able to update the checkout successfully but run into "Cannot complete the checkout without any transactions." while trying to complete a checkout without payment

 

 

{
"checkout": {
"token": "token",
"order": null
}
}

 

 

 

Appreciate any help !

 

Edit : For any one running into the same issue the order value should be $0.