AppPurchaseOneTimeCreate does not respect `test` field value

I’m testing single purchase AppPurchaseOneTimeCreate, setting test: true according to the docs

```variables: {
name: ‘App Subscription Single Purchase Charge’,
returnUrl: ‘’,
price: { amount: 190, currencyCode: ‘USD’ },
test: true
}```

When I query the id, says test: false so I can’t test my full flow, I get error The shop cannot accept the provided charge.

Anyone else having this problem? Any solution?

1 Like

Hi @William_Belk

The Shopify Remix template I’m using supports billing.

const billingCheck = await billing.require({
      plans: [MONTHLY_0_5_PLAN, MONTHLY_1_5_PLAN, MONTHLY_2_5_PLAN, PURCHASE_ONE_TIME_PLAN],
      isTest: true,
      returnUrl: '/app/subscription',
      onFailure: () => redirect('/app/subscription'),
    });

You can try using `isTest: true`.

thanks @kyle_liu already tried that from another thread, doesn’t seem to work either

Hey William, according to the appPurchaseOneTimeCreate docs, test: true should work. I’d like to help replicate this on my end. Could you share:

  1. The full GraphQL mutation you’re sending (not just the variables). I’ve seen cases where the test field gets ignored due to syntax issues
  2. The complete API response when you create the charge (including any userErrors and the x-request-id from the response headers)
  3. The query you’re using to check the charge afterward that shows test: false

Once I can see the exact request/response, I can try to reproduce it and figure out what’s going on.

Hey @William_Belk are you still experiencing this issue, or can I mark this as solved?

@KyleG-Shopify still seems broken to me

x-request-id
c48a9d09-73b5-4b3a-bfe9-eba11c4f1745-1766315698

query
mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!) {
appPurchaseOneTimeCreate(name: $name, returnUrl: $returnUrl, price: $price) {
userErrors {
field
message
}
appPurchaseOneTime {
createdAt
id
}
confirmationUrl
}
}

variables

{
name: ‘App Subscription Single Purchase Charge’,
returnUrl: ‘****’,
price: { amount: 5, currencyCode: ‘USD’ },
test: true
}

then to check it

query

{
node(id: “gid://shopify/AppPurchaseOneTime/***”) {
… on AppPurchaseOneTime {
price {
amount
currencyCode
}
createdAt
id
name
status
test
}
}
}

Hey @William_Belk, your mutation definition is missing the $test parameter, so it’s being ignored when you pass it in the variables.

If you add $test: Boolean to the parameter list it should work.

Ahhh, thanks @KyleG-Shopify, that’s my dumb mistake, got it working to test

1 Like