# appPurchaseOneTimeCreate - admin-graphql - MUTATION
Version: 2025-01

## Description
Charges a shop for features or services one time.
This type of charge is recommended for apps that aren't billed on a recurring basis.
Test and demo shops aren't charged.

### Access Scopes



## Arguments
* [name](/docs/api/admin-graphql/2025-01/scalars/String): String! - The name of the one-time purchase from the app.
* [price](/docs/api/admin-graphql/2025-01/input-objects/MoneyInput): MoneyInput! - The amount to be charged to the store for the app one-time purchase.
* [returnUrl](/docs/api/admin-graphql/2025-01/scalars/URL): URL! - The URL where the merchant is redirected after approving the app one-time purchase.
* [test](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean - Whether the app one-time purchase is a test transaction.


## Returns
* [appPurchaseOneTime](/docs/api/admin-graphql/2025-01/objects/AppPurchaseOneTime): AppPurchaseOneTime The newly created app one-time purchase.
* [confirmationUrl](/docs/api/admin-graphql/2025-01/scalars/URL): URL The URL that the merchant can access to approve or decline the newly created app one-time purchase.

If the merchant declines, then the merchant is redirected to the app and receives a notification message stating that the charge was declined.
If the merchant approves and they're successfully invoiced, then the state of the charge changes from `pending` to `active`.

You get paid after the charge is activated.
* [userErrors](/docs/api/admin-graphql/2025-01/objects/UserError): UserError! The list of errors that occurred from executing the mutation.


## Examples
### Creates an application charge
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!) { appPurchaseOneTimeCreate(name: $name, returnUrl: $returnUrl, price: $price) { userErrors { field message } appPurchaseOneTime { createdAt id } confirmationUrl } }\",\n \"variables\": {\n    \"name\": \"1000 imported orders.\",\n    \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n    \"price\": {\n      \"amount\": 10.0,\n      \"currencyCode\": \"USD\"\n    }\n  }\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n  data: {\n    \"query\": `mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!) {\n      appPurchaseOneTimeCreate(name: $name, returnUrl: $returnUrl, price: $price) {\n        userErrors {\n          field\n          message\n        }\n        appPurchaseOneTime {\n          createdAt\n          id\n        }\n        confirmationUrl\n      }\n    }`,\n    \"variables\": {\n      \"name\": \"1000 imported orders.\",\n      \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n      \"price\": {\n        \"amount\": 10.0,\n        \"currencyCode\": \"USD\"\n      }\n    },\n  },\n});\n"
Ruby example: "session = ShopifyAPI::Auth::Session.new(\n  shop: \"your-development-store.myshopify.com\",\n  access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n  session: session\n)\n\nquery = <<~QUERY\n  mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!) {\n    appPurchaseOneTimeCreate(name: $name, returnUrl: $returnUrl, price: $price) {\n      userErrors {\n        field\n        message\n      }\n      appPurchaseOneTime {\n        createdAt\n        id\n      }\n      confirmationUrl\n    }\n  }\nQUERY\n\nvariables = {\n  \"name\": \"1000 imported orders.\",\n  \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n  \"price\": {\n    \"amount\": 10.0,\n    \"currencyCode\": \"USD\"\n  }\n}\n\nresponse = client.query(query: query, variables: variables)\n" 
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n  `#graphql\n  mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!) {\n    appPurchaseOneTimeCreate(name: $name, returnUrl: $returnUrl, price: $price) {\n      userErrors {\n        field\n        message\n      }\n      appPurchaseOneTime {\n        createdAt\n        id\n      }\n      confirmationUrl\n    }\n  }`,\n  {\n    variables: {\n      \"name\": \"1000 imported orders.\",\n      \"returnUrl\": \"http://super-duper.shopifyapps.com/\",\n      \"price\": {\n        \"amount\": 10.0,\n        \"currencyCode\": \"USD\"\n      }\n    },\n  },\n);\n\nconst data = await response.json();\n"
Graphql query: "mutation AppPurchaseOneTimeCreate($name: String!, $price: MoneyInput!, $returnUrl: URL!) {\n  appPurchaseOneTimeCreate(name: $name, returnUrl: $returnUrl, price: $price) {\n    userErrors {\n      field\n      message\n    }\n    appPurchaseOneTime {\n      createdAt\n      id\n    }\n    confirmationUrl\n  }\n}"
#### Graphql Input
{
  "name": "1000 imported orders.",
  "returnUrl": "http://super-duper.shopifyapps.com/",
  "price": {
    "amount": 10.0,
    "currencyCode": "USD"
  }
}
#### Graphql Response
{
  "data": {
    "appPurchaseOneTimeCreate": {
      "userErrors": [],
      "appPurchaseOneTime": {
        "createdAt": "2024-11-21T22:47:04Z",
        "id": "gid://shopify/AppPurchaseOneTime/1017262352"
      },
      "confirmationUrl": "https://billingshop.myshopify.com/admin/charges/193172482/1017262352/ApplicationCharge/confirm_application_charge?signature=BAh7BzoHaWRpBBAxojw6EmF1dG9fYWN0aXZhdGVU--a03eedf9ef12d714906af085ebc2aa3d97aa9466"
    }
  }
}