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.

Re: How to use reserved prefix in input.graphql of extension?

How to use reserved prefix in input.graphql of extension?

Bakabona
Shopify Partner
2 0 0

I'm creating payment customization app using Javascript. I used reserved prefix for namespace with reference to the following tutrial.
https://shopify.dev/docs/apps/checkout/payment-customizations/ui

By referring to Step2 of the tutorial, I tried the following input.graphql to get metafield value, but I couldn't.

 

query Input {
    paymentCustomization {
        metafield(namespace: "$app:payment-customization", key: "function-config") {
            value
        }
    }
}

 

When I used actual value (SHOPIFY_API_KEY) instead of $app, it worked fine.

 

query Input {
    paymentCustomization {
        metafield(namespace: "XXXXXXXXXXXX:payment-customization", key: "function-config") {
            value
        }
    }
}

 

I must have forgotten some procedure.
How can I set $app value?

Thank you.

Replies 2 (2)

lizk
Shopify Staff
246 58 79

Hi could you share what error was returned to you when you used $app:payment-customization.

To learn more visit the Shopify Help Center or the Community Blog.

Bakabona
Shopify Partner
2 0 0

Hi, thank you for your message.

I'm using of Shopify CLI (3.48.4) and I had no errors in running typegen or deploy the extension. I have made index.js that only displays input values in standard error that we can see in Shopify Partners page.

...
(input) => {
    console.error(JSON.stringify(input));
    ...
}

When I used $app in input.graphql, I got standard error like this.

{
  "paymentCustomization": {
    "metafield": null
  }
}

When I used actual value (SHOPIFY_API_KEY), I got the followings that I set.

{
  "paymentCustomization": {
    "metafield": {
      "value": "{\"methods\":[{\"name\":\"Cash on Delivery (COD)\",\"label\":\"\",\"active\":true,\"rules\":[]}]}"
    }
  }
}

I have no idea how I should set $app value.
Thank you.