Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Shopify Payment APP API returning 500 error

Solved

Shopify Payment APP API returning 500 error

Shawn_Chang
Visitor
2 0 0

 

I got an error when I captured an authorized payment using Shopify Payment APP API.
Is there any issue with my App or on Shopify?
Is there anybody who knows why this error happened?
Here is my transactions details.

 

Shopify request:

 

{
  "id": "IYY5B6e7K6Byq01cyQgxH0b6",
  "gid": "gid://shopify/CaptureSession/IYY5B6e7K6Byq01cyQgxH0b6",
  "payment_id": "y0fghtNZWUoAgfcBtPcBQlqw",
  "amount": "106.48",
  "currency": "TWD",
  "merchant_locale": "zh-TW",
  "proposed_at": "2021-12-13T05:58:20Z"
}

 

 

App request:

 

URL: https://ecpay-php.myshopify.com/payments_apps/api/2021-10/graphql.json
Headers: {
  "X-Shopify-Access-Token": "my token",
  "Content-Type": "application/json"
},
Body: {
  "query": "mutation CaptureSessionResolve($id: ID!) { captureSessionResolve(id: $id) { captureSession { id } userErrors { code field message } } }",
  "variables": {
    "id": "gid://shopify/CaptureSession/IYY5B6e7K6Byq01cyQgxH0b6"
  }
}

 

 

Shopify response:

 

Body: {
  "errors": [
    {
      "message": "Internal error. Looks like something went wrong on our end.\nRequest ID: bd75a533-b608-40b0-b043-f2e2e33da462 (include this in support requests).",
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "requestId": "bd75a533-b608-40b0-b043-f2e2e33da462"
      }
    }
  ]
}

 

 

Ref: https://shopify.dev/apps/payments/capturing-an-authorized-payment

Accepted Solution (1)

Luke_K
Shopify Staff
402 66 102

This is an accepted solution.

Hey @Shawn_Chang 

 

I found that this arises when the resolve mutation is called too quickly - or if the partners app responds 201 and the resolve mutation is called at the same time, the Order Transaction ID cannot be found (which is what happened here on that request ID provided).

 

We'll be including functionality that will enable partners to respond 201 and call the mutation without having to wait a couple of seconds. I can provide an ETA of this unfortunately, but for the meantime, the resolve mutation should not be sent at the same time as the 201 response. 

 

It's worth noting though that this response can be resolved with a retry. Hope that helps!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!

View solution in original post

Replies 4 (4)

ada29
Tourist
7 0 1

Hi! Unfortunately I don't have a response for your issue, as I haven't reached this step yet, but I want to ask if you encountered issues at processing a payment? I have an opened discussion for it https://community.shopify.com/c/shopify-apis-and-sdks/payments-app-no-backend-requests-received-from...

 

Thanks.

Luke_K
Shopify Staff
402 66 102

This is an accepted solution.

Hey @Shawn_Chang 

 

I found that this arises when the resolve mutation is called too quickly - or if the partners app responds 201 and the resolve mutation is called at the same time, the Order Transaction ID cannot be found (which is what happened here on that request ID provided).

 

We'll be including functionality that will enable partners to respond 201 and call the mutation without having to wait a couple of seconds. I can provide an ETA of this unfortunately, but for the meantime, the resolve mutation should not be sent at the same time as the 201 response. 

 

It's worth noting though that this response can be resolved with a retry. Hope that helps!

| Shopify |
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution!
Shawn_Chang
Visitor
2 0 0

Hi @Luke_K

 

Thank you so much. I will implement the retry policy 🙂

JuanGrasso
Shopify Partner
20 3 4

Hi there, I had exactly the same problem and resolved it aplying a retry policy.