mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!) {
appPurchaseOneTimeCreate(name: $name, returnUrl: $returnUrl, price: $price) {
userErrors {
field
message
}
appPurchaseOneTime {
createdAt
id
}
confirmationUrl
}
}
curl -X POST \
https://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \
-H 'Content-Type: application/json' \
-H 'X-Shopify-Access-Token: {access_token}' \
-d '{
"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": "1000 imported orders.",
"returnUrl": "http://super-duper.shopifyapps.com/",
"price": {
"amount": 10.0,
"currencyCode": "USD"
}
}
}'
const { admin } = await authenticate.admin(request);
const response = await admin.graphql(
`#graphql
mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!) {
appPurchaseOneTimeCreate(name: $name, returnUrl: $returnUrl, price: $price) {
userErrors {
field
message
}
appPurchaseOneTime {
createdAt
id
}
confirmationUrl
}
}`,
{
variables: {
"name": "1000 imported orders.",
"returnUrl": "http://super-duper.shopifyapps.com/",
"price": {
"amount": 10.0,
"currencyCode": "USD"
}
},
},
);
const data = await response.json();
session = ShopifyAPI::Auth::Session.new(
shop: "your-development-store.myshopify.com",
access_token: access_token
)
client = ShopifyAPI::Clients::Graphql::Admin.new(
session: session
)
query = <<~QUERY
mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!) {
appPurchaseOneTimeCreate(name: $name, returnUrl: $returnUrl, price: $price) {
userErrors {
field
message
}
appPurchaseOneTime {
createdAt
id
}
confirmationUrl
}
}
QUERY
variables = {
"name": "1000 imported orders.",
"returnUrl": "http://super-duper.shopifyapps.com/",
"price": {
"amount": 10.0,
"currencyCode": "USD"
}
}
response = client.query(query: query, variables: variables)
const client = new shopify.clients.Graphql({session});
const data = await client.query({
data: {
"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": "1000 imported orders.",
"returnUrl": "http://super-duper.shopifyapps.com/",
"price": {
"amount": 10.0,
"currencyCode": "USD"
}
},
},
});
use Shopify\Clients\Graphql;
$client = new Graphql("your-development-store.myshopify.com", $accessToken);
$query = <<<QUERY
mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!) {
appPurchaseOneTimeCreate(name: $name, returnUrl: $returnUrl, price: $price) {
userErrors {
field
message
}
appPurchaseOneTime {
createdAt
id
}
confirmationUrl
}
}
QUERY;
$variables = [
"name" => "1000 imported orders.",
"returnUrl" => "http://super-duper.shopifyapps.com/",
"price" => [
"amount" => 10.0,
"currencyCode" => "USD",
],
];
$response = $client->query(["query" => $query, "variables" => $variables]);