Post Purchase Extension - applyChangeset

Hi everyone,

I’m building a post purchase extension. Everything is going perfect until the last step of the “applyChangeset(token)”

I create my token as recommended. I also verify my token on the https://jwt.io/ and it seems verified.

But I get “500 - Intersal Server Error”

When I try a broken token it gives 400 Error ([{code: “invalid_request”, message: “Invalid issuer”}]) But even the token is correct, why do I get 500 - Internal Server Error?

I’m using a staging app. My app is not live… I’m testing it on my test store…

Any ideas to fix this problem?

Hi there! Could you give us a little more information on what you’re trying to do? It’s hard to guess at why the error might be happening without more information. For example: what is the intended use of the post purchase extension? What is the structure of the changeset you’re trying to apply?

In this thread someone had a similar issue that might’ve been because of CORS errors and using webhooks seems to have fixed their issues. Could that be what you’re running into?

Hi Kristofer,

Thanks a lot for your reply. I want to use it for the “upsell at the post-purchase”

Here is the changes I’m applying:

changes: [
            {
              type: "add_variant",
              variantId: 46193179623665,
              quantity: 1,
              discount: {
                value: 15,
                valueType: "percentage",
                title: "15% off"
              }
            }
          ]

I’m following the guide in here: Build a post-purchase product offer checkout extension

Everything went great but I’m stack at the last step. When I click on the “Accept offer” button, it should add the product but it gives 500 error…


I start my local development with “shopify app dev” command and then follow the checkout post-purchase link to preview…

P.S: In the thread you mentioned, their “applyChangeset” succeed. In my case “applyChangeset” creates the problem. It gives to 500 Internal Server Error.

Hi Kristofer,

Kristofer, I still haven’t found a solution… How can I find out the cause of this error, why it’s happening, and how I can fix it?

Hi @Muhammed_Tufekyapan

DMing you to get more details on your app to help us with troubleshooting this :slight_smile:

1 Like