Error when testing checkout API with Stripe "Cannot complete the checkout without any transactions."

Solved
baumannalexj
New Member
2 0 2

Hello, 

I am trying to complete a checkout with the /checkout API integrated with Stripe, following this documentation: https://shopify.dev/tutorials/complete-a-sales-channel-payment-with-checkout-api#integrate-stripe-wi... 

I am getting this response on my final request: 

Request:

curl --location --request POST 'https://<nameofmyshop>.myshopify.com/admin/api/2021-04/checkouts/<shopify-checkout-token>/complete.json' \
--header 'Content-Type: application/json' \
--header 'X-Shopify-Access-Token: <shpat_shopify-access-token>' \
--data-raw '{
    "payment": {
        "amount": "1.00",
        "unique_token": "unique token I made",
        "payment_token": {
            "payment_data": "<tok_stripe-vault-token>",
            "type": "stripe_vault_token"
        },
        "request_details": {
            "ip_address": "123.1.1.1",
            "accept_language": "en",
            "user_agent": "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/54.0.2840.98 Safari\/537.36"
        }
    }
}'


(error) Response: 

422 Unprocessable Entity

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

 

Some details about my Shopify Shop, and Stripe setup:

  • I have Shopify Payments enabled
  • test mode is on:baumannalexj_0-1619369167433.png

     

  • I successfully placed an order though the shop's website with CC# 4242 4242 4242 4242
  • I have a test Stripe Connect account for my "customer"
  • I can successfully get a Stripe token generated for the customer

Here is my flow:

1. create a checkout POST https://{{store_name}}.myshopify.com/admin/api/{{api_version}}/checkouts.json

2. Save checkout.token, and checkout.shopify_payments_account_id from the response

3. Get Stripe token for customer: 

curl --location --request POST 'https://api.stripe.com/v1/tokens' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'Stripe-Account: {{shopify_payments_account_id}}' \
--header 'Authorization: Bearer {{stripe-token}}' \
--data-urlencode 'customer=<cus_customers-stripe-connect-id>'

 4. save id from response "id: <tok_stripe-vault-token>"

5. complete checkout with Stripe token (request above)


Should we be able to complete a checkout using Shopify /checkout API + Stripe-Connect Test Accounts?

baumannalexj
New Member
2 0 2

Answer:

I was using the wrong endpoint:

final request should go to /payments.json, not /complete.json

url --location --request POST 'https://<nameofmyshop>.myshopify.com/admin/api/2021-04/checkouts/<shopify-checkout-token>/payments.json' \
--header 'Content-Type: application/json' \
--header 'X-Shopify-Access-Token: <shpat_shopify-access-token>' \
--data-raw '{
    "payment": {
        "amount": "1.00",
        "unique_token": "unique token I made",
        "payment_token": {
            "payment_data": "<tok_stripe-vault-token>",
            "type": "stripe_vault_token"
        },
        "request_details": {
            "ip_address": "123.1.1.1",
            "accept_language": "en",
            "user_agent": "Mozilla\/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/54.0.2840.98 Safari\/537.36"
        }
    }
}'

 

gavinnfoster
New Member
1 1 1

This is an accepted solution.

Hey!

I think you want to use a different endpoint: 

/admin/checkouts/#{token}/payments.json

 documented on this page https://shopify.dev/tutorials/complete-a-sales-channel-payment-with-checkout-api#integrate-stripe-wi...