Re: GraphQL Billing API test charge

GraphQL Billing API test charge

COChrisWong
Visitor
2 0 0

Hi guys, I'm using GraphQL billing API to do a app install payment and here is my query.

 

{
        "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": "TEST one-time purchase",
            "test": true,
            "returnUrl": "my domain callback",
            "price": {
              "amount": 1.0,
              "currencyCode": "USD"
            }
          }
        }

 

 

I have set the "test" as true, but shopify still asking me to add credit card to my account, I cannot use the test charge.

 

image.png

 

Did I miss anything to do or is there any solution? shopify support only keep post me the document here

Replies 6 (6)

Georgekpc
Shopify Partner
17 0 2

Have a look at the documention

You have to pass "test" as an argument to "appPurchaseOneTimeCreate"

LetterT
Shopify Partner
53 5 19

Seems like he already did

"test": true,

 

Don't be shy, click that like button!
LetterT
Shopify Partner
53 5 19

hmm, maybe not ...

 

appPurchaseOneTime { createdAt, id, }

should probably include test, eg:

appPurchaseOneTime { createdAt, id, test }

 

Don't be shy, click that like button!
LetterT
Shopify Partner
53 5 19

and also include test for:

mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!)

 ie:

mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!, $test: Boolean!)

 

Don't be shy, click that like button!
LetterT
Shopify Partner
53 5 19

this works for me:

mutation appPurchaseOneTimeCreate($name: String!, $returnUrl: URL!, $price: MoneyInput!, $test: Boolean!) {
  appPurchaseOneTimeCreate(name: $name, returnUrl: $returnUrl, price: $price, test: $test) {
    userErrors {
      field
      message
    }
    appPurchaseOneTime {
      createdAt
      id
      name
      price {
        amount
        currencyCode
      }
      status
      test
    }
    confirmationUrl
  }
}
{
  "name": "1000 imported orders.",
  "returnUrl": "http://super-duper.shopifyapps.com/",
  "price": {
    "amount": 10,
    "currencyCode": "USD"
  },
  "test": true
}

 

Don't be shy, click that like button!
KevinLopezBC
Shopify Partner
8 0 1

Thank you!