ApplicationCharge
The ApplicationCharge resource facilitates one-time charges. This type of charge is recommended for apps that aren’t billed on a recurring basis. You can create an application charge by sending a request with the name the charge should appear under, the price your app is charging, and a return URL where Shopify redirects the merchant after the charge is accepted. After you've created the charge, redirect the merchant to the confirmation URL returned by Shopify. If the charge is declined, then Shopify redirects the merchant and provides a notification message that the app charge was declined. For step-by-step guidance that walks through this flow using examples, see our implementation guide.
Note
For testing purposes you can include "test": true
when creating the charge. This prevents the credit card from being charged.
Test shops and demo shops can't be charged.
What you can do with ApplicationCharge
The Shopify API lets you do the following with the ApplicationCharge resource. More detailed versions of these general actions may be available:
- POST /admin/api/2019-10/application_charges.json Creates an application charge
- GET /admin/api/2019-10/application_charges/{application_charge_id}.json Retrieves an application charge
- GET /admin/api/2019-10/application_charges.json Retrieves a list of application charges
- POST /admin/api/2019-10/application_charges/{application_charge_id}/activate.json Removed in version 2021-01. Activates an application charge.
ApplicationCharge properties
confirmation_url |
The URL where the merchant accepts or declines the application charge. |
created_at |
The date and time (ISO 8601 format) when the application charge was created. |
id |
The ID of the application charge. |
name |
The application charge name. |
price |
The price of the application charge. The minimum price is 0.50, and maximum price is 10,000. |
return_url |
The URL where the merchant is redirected after accepting a charge. |
status |
The status of the application charge. Valid values:
|
test |
Whether the application charge is a test transaction. Valid values: |
updated_at |
The date and time (ISO 8601 format) when the charge was last updated. |
Endpoints
Create an application charge
POST /admin/api/2019-10/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262352,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": null,
"created_at": "2021-02-05T20:36:11-05:00",
"updated_at": "2021-02-05T20:36:11-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262352",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262352/confirm_application_charge?signature=BAh7BzoHaWRpBBAxojw6EmF1dG9fYWN0aXZhdGVU--f83da2d90a5af2a1484196a5e701764b0dbe10d6"
}
}
Create a test charge that will not cause a credit card to be charged
POST /admin/api/2019-10/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com",
"test": true
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262353,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": true,
"created_at": "2021-02-05T20:36:13-05:00",
"updated_at": "2021-02-05T20:36:13-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262353",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262353/confirm_application_charge?signature=BAh7BzoHaWRpBBExojw6EmF1dG9fYWN0aXZhdGVU--48f2976b86209785e94e1fd6d3d47141d1513fe9"
}
}
Trying to create a charge without a price or name will return an error
POST /admin/api/2019-10/application_charges.json
{
"application_charge": {
"name": ""
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"name": [
"can't be blank"
],
"price": [
"must be greater than or equal to 0.5"
]
}
}
Trying to create a charge with a price less than 0.50 will return an error
POST /admin/api/2019-10/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 0.4,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"price": [
"must be greater than or equal to 0.5"
]
}
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve an application charge
GET /admin/api/2019-10/application_charges/675931192.json
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
since_id
|
Restrict results to after the specified ID. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve all application charges
GET /admin/api/2019-10/application_charges.json
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
},
{
"id": 556467234,
"name": "Green theme",
"api_client_id": 755357713,
"price": "120.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "theme",
"decorated_return_url": "http://google.com?charge_id=556467234"
},
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
]
}
Retrieve all application charges since a specified ID
GET /admin/api/2019-10/application_charges.json?since_id=556467234
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
},
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
}
]
}
Activate an application charge
POST /admin/api/2019-10/application_charges/675931192/activate.json
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "active",
"return_url": "http://google.com/",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:36:06-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com/?charge_id=675931192"
}
}
The ApplicationCharge resource facilitates one-time charges. This type of charge is recommended for apps that aren’t billed on a recurring basis. You can create an application charge by sending a request with the name the charge should appear under, the price your app is charging, and a return URL where Shopify redirects the merchant after the charge is accepted. After you've created the charge, redirect the merchant to the confirmation URL returned by Shopify. If the charge is declined, then Shopify redirects the merchant and provides a notification message that the app charge was declined. For step-by-step guidance that walks through this flow using examples, see our implementation guide.
Note
For testing purposes you can include "test": true
when creating the charge. This prevents the credit card from being charged.
Test shops and demo shops can't be charged.
What you can do with ApplicationCharge
The Shopify API lets you do the following with the ApplicationCharge resource. More detailed versions of these general actions may be available:
- POST /admin/api/2020-01/application_charges.json Creates an application charge
- GET /admin/api/2020-01/application_charges/{application_charge_id}.json Retrieves an application charge
- GET /admin/api/2020-01/application_charges.json Retrieves a list of application charges
- POST /admin/api/2020-01/application_charges/{application_charge_id}/activate.json Removed in version 2021-01. Activates an application charge.
ApplicationCharge properties
confirmation_url |
The URL where the merchant accepts or declines the application charge. |
created_at |
The date and time (ISO 8601 format) when the application charge was created. |
id |
The ID of the application charge. |
name |
The application charge name. |
price |
The price of the application charge. The minimum price is 0.50, and maximum price is 10,000. |
return_url |
The URL where the merchant is redirected after accepting a charge. |
status |
The status of the application charge. Valid values:
|
test |
Whether the application charge is a test transaction. Valid values: |
updated_at |
The date and time (ISO 8601 format) when the charge was last updated. |
Endpoints
Create an application charge
POST /admin/api/2020-01/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262352,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": null,
"created_at": "2021-02-05T20:36:11-05:00",
"updated_at": "2021-02-05T20:36:11-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262352",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262352/confirm_application_charge?signature=BAh7BzoHaWRpBBAxojw6EmF1dG9fYWN0aXZhdGVU--f83da2d90a5af2a1484196a5e701764b0dbe10d6"
}
}
Create a test charge that will not cause a credit card to be charged
POST /admin/api/2020-01/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com",
"test": true
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262353,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": true,
"created_at": "2021-02-05T20:36:13-05:00",
"updated_at": "2021-02-05T20:36:13-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262353",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262353/confirm_application_charge?signature=BAh7BzoHaWRpBBExojw6EmF1dG9fYWN0aXZhdGVU--48f2976b86209785e94e1fd6d3d47141d1513fe9"
}
}
Trying to create a charge without a price or name will return an error
POST /admin/api/2020-01/application_charges.json
{
"application_charge": {
"name": ""
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"name": [
"can't be blank"
],
"price": [
"must be greater than or equal to 0.5"
]
}
}
Trying to create a charge with a price less than 0.50 will return an error
POST /admin/api/2020-01/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 0.4,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"price": [
"must be greater than or equal to 0.5"
]
}
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve an application charge
GET /admin/api/2020-01/application_charges/675931192.json
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
since_id
|
Restrict results to after the specified ID. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve all application charges
GET /admin/api/2020-01/application_charges.json
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
},
{
"id": 556467234,
"name": "Green theme",
"api_client_id": 755357713,
"price": "120.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "theme",
"decorated_return_url": "http://google.com?charge_id=556467234"
},
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
]
}
Retrieve all application charges since a specified ID
GET /admin/api/2020-01/application_charges.json?since_id=556467234
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
},
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
}
]
}
Activate an application charge
POST /admin/api/2020-01/application_charges/675931192/activate.json
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "active",
"return_url": "http://google.com/",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:36:06-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com/?charge_id=675931192"
}
}
The ApplicationCharge resource facilitates one-time charges. This type of charge is recommended for apps that aren’t billed on a recurring basis. You can create an application charge by sending a request with the name the charge should appear under, the price your app is charging, and a return URL where Shopify redirects the merchant after the charge is accepted. After you've created the charge, redirect the merchant to the confirmation URL returned by Shopify. If the charge is declined, then Shopify redirects the merchant and provides a notification message that the app charge was declined. For step-by-step guidance that walks through this flow using examples, see our implementation guide.
Note
For testing purposes you can include "test": true
when creating the charge. This prevents the credit card from being charged.
Test shops and demo shops can't be charged.
What you can do with ApplicationCharge
The Shopify API lets you do the following with the ApplicationCharge resource. More detailed versions of these general actions may be available:
- POST /admin/api/2020-04/application_charges.json Creates an application charge
- GET /admin/api/2020-04/application_charges/{application_charge_id}.json Retrieves an application charge
- GET /admin/api/2020-04/application_charges.json Retrieves a list of application charges
- POST /admin/api/2020-04/application_charges/{application_charge_id}/activate.json Removed in version 2021-01. Activates an application charge.
ApplicationCharge properties
confirmation_url |
The URL where the merchant accepts or declines the application charge. |
created_at |
The date and time (ISO 8601 format) when the application charge was created. |
id |
The ID of the application charge. |
name |
The application charge name. |
price |
The price of the application charge. The minimum price is 0.50, and maximum price is 10,000. |
return_url |
The URL where the merchant is redirected after accepting a charge. |
status |
The status of the application charge. Valid values:
|
test |
Whether the application charge is a test transaction. Valid values: |
updated_at |
The date and time (ISO 8601 format) when the charge was last updated. |
Endpoints
Create an application charge
POST /admin/api/2020-04/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262352,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": null,
"created_at": "2021-02-05T20:36:11-05:00",
"updated_at": "2021-02-05T20:36:11-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262352",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262352/confirm_application_charge?signature=BAh7BzoHaWRpBBAxojw6EmF1dG9fYWN0aXZhdGVU--f83da2d90a5af2a1484196a5e701764b0dbe10d6"
}
}
Create a test charge that will not cause a credit card to be charged
POST /admin/api/2020-04/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com",
"test": true
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262353,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": true,
"created_at": "2021-02-05T20:36:13-05:00",
"updated_at": "2021-02-05T20:36:13-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262353",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262353/confirm_application_charge?signature=BAh7BzoHaWRpBBExojw6EmF1dG9fYWN0aXZhdGVU--48f2976b86209785e94e1fd6d3d47141d1513fe9"
}
}
Trying to create a charge without a price or name will return an error
POST /admin/api/2020-04/application_charges.json
{
"application_charge": {
"name": ""
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"name": [
"can't be blank"
],
"price": [
"must be greater than or equal to 0.5"
]
}
}
Trying to create a charge with a price less than 0.50 will return an error
POST /admin/api/2020-04/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 0.4,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"price": [
"must be greater than or equal to 0.5"
]
}
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve an application charge
GET /admin/api/2020-04/application_charges/675931192.json
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
since_id
|
Restrict results to after the specified ID. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve all application charges
GET /admin/api/2020-04/application_charges.json
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
},
{
"id": 556467234,
"name": "Green theme",
"api_client_id": 755357713,
"price": "120.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "theme",
"decorated_return_url": "http://google.com?charge_id=556467234"
},
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
]
}
Retrieve all application charges since a specified ID
GET /admin/api/2020-04/application_charges.json?since_id=556467234
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
},
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
}
]
}
Activate an application charge
POST /admin/api/2020-04/application_charges/675931192/activate.json
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "active",
"return_url": "http://google.com/",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:36:06-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com/?charge_id=675931192"
}
}
The ApplicationCharge resource facilitates one-time charges. This type of charge is recommended for apps that aren’t billed on a recurring basis. You can create an application charge by sending a request with the name the charge should appear under, the price your app is charging, and a return URL where Shopify redirects the merchant after the charge is accepted. After you've created the charge, redirect the merchant to the confirmation URL returned by Shopify. If the charge is declined, then Shopify redirects the merchant and provides a notification message that the app charge was declined. For step-by-step guidance that walks through this flow using examples, see our implementation guide.
Note
For testing purposes you can include "test": true
when creating the charge. This prevents the credit card from being charged.
Test shops and demo shops can't be charged.
What you can do with ApplicationCharge
The Shopify API lets you do the following with the ApplicationCharge resource. More detailed versions of these general actions may be available:
- POST /admin/api/2020-07/application_charges.json Creates an application charge
- GET /admin/api/2020-07/application_charges/{application_charge_id}.json Retrieves an application charge
- GET /admin/api/2020-07/application_charges.json Retrieves a list of application charges
- POST /admin/api/2020-07/application_charges/{application_charge_id}/activate.json Removed in version 2021-01. Activates an application charge.
ApplicationCharge properties
confirmation_url |
The URL where the merchant accepts or declines the application charge. |
created_at |
The date and time (ISO 8601 format) when the application charge was created. |
id |
The ID of the application charge. |
name |
The application charge name. |
price |
The price of the application charge. The minimum price is 0.50, and maximum price is 10,000. |
return_url |
The URL where the merchant is redirected after accepting a charge. |
status |
The status of the application charge. Valid values:
|
test |
Whether the application charge is a test transaction. Valid values: |
updated_at |
The date and time (ISO 8601 format) when the charge was last updated. |
Endpoints
Create an application charge
POST /admin/api/2020-07/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262352,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": null,
"created_at": "2021-02-05T20:36:11-05:00",
"updated_at": "2021-02-05T20:36:11-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262352",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262352/confirm_application_charge?signature=BAh7BzoHaWRpBBAxojw6EmF1dG9fYWN0aXZhdGVU--f83da2d90a5af2a1484196a5e701764b0dbe10d6"
}
}
Create a test charge that will not cause a credit card to be charged
POST /admin/api/2020-07/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com",
"test": true
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262353,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": true,
"created_at": "2021-02-05T20:36:13-05:00",
"updated_at": "2021-02-05T20:36:13-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262353",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262353/confirm_application_charge?signature=BAh7BzoHaWRpBBExojw6EmF1dG9fYWN0aXZhdGVU--48f2976b86209785e94e1fd6d3d47141d1513fe9"
}
}
Trying to create a charge without a price or name will return an error
POST /admin/api/2020-07/application_charges.json
{
"application_charge": {
"name": ""
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"name": [
"can't be blank"
],
"price": [
"must be greater than or equal to 0.5"
]
}
}
Trying to create a charge with a price less than 0.50 will return an error
POST /admin/api/2020-07/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 0.4,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"price": [
"must be greater than or equal to 0.5"
]
}
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve an application charge
GET /admin/api/2020-07/application_charges/675931192.json
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
since_id
|
Restrict results to after the specified ID. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve all application charges
GET /admin/api/2020-07/application_charges.json
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
},
{
"id": 556467234,
"name": "Green theme",
"api_client_id": 755357713,
"price": "120.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "theme",
"decorated_return_url": "http://google.com?charge_id=556467234"
},
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
]
}
Retrieve all application charges since a specified ID
GET /admin/api/2020-07/application_charges.json?since_id=556467234
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
},
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
}
]
}
Activate an application charge
POST /admin/api/2020-07/application_charges/675931192/activate.json
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "active",
"return_url": "http://google.com/",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:36:06-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com/?charge_id=675931192"
}
}
The ApplicationCharge resource facilitates one-time charges. This type of charge is recommended for apps that aren’t billed on a recurring basis. You can create an application charge by sending a request with the name the charge should appear under, the price your app is charging, and a return URL where Shopify redirects the merchant after the charge is accepted. After you've created the charge, redirect the merchant to the confirmation URL returned by Shopify. If the charge is declined, then Shopify redirects the merchant and provides a notification message that the app charge was declined. For step-by-step guidance that walks through this flow using examples, see our implementation guide.
Note
For testing purposes you can include "test": true
when creating the charge. This prevents the credit card from being charged.
Test shops and demo shops can't be charged.
What you can do with ApplicationCharge
The Shopify API lets you do the following with the ApplicationCharge resource. More detailed versions of these general actions may be available:
- POST /admin/api/2020-10/application_charges.json Creates an application charge
- GET /admin/api/2020-10/application_charges/{application_charge_id}.json Retrieves an application charge
- GET /admin/api/2020-10/application_charges.json Retrieves a list of application charges
- POST /admin/api/2020-10/application_charges/{application_charge_id}/activate.json Removed in version 2021-01. Activates an application charge.
ApplicationCharge properties
confirmation_url |
The URL where the merchant accepts or declines the application charge. |
created_at |
The date and time (ISO 8601 format) when the application charge was created. |
id |
The ID of the application charge. |
name |
The application charge name. |
price |
The price of the application charge. The minimum price is 0.50, and maximum price is 10,000. |
return_url |
The URL where the merchant is redirected after accepting a charge. |
status |
The status of the application charge. Valid values:
|
test |
Whether the application charge is a test transaction. Valid values: |
updated_at |
The date and time (ISO 8601 format) when the charge was last updated. |
Endpoints
Create an application charge
POST /admin/api/2020-10/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262352,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": null,
"created_at": "2021-02-05T20:36:11-05:00",
"updated_at": "2021-02-05T20:36:11-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262352",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262352/confirm_application_charge?signature=BAh7BzoHaWRpBBAxojw6EmF1dG9fYWN0aXZhdGVU--f83da2d90a5af2a1484196a5e701764b0dbe10d6"
}
}
Create a test charge that will not cause a credit card to be charged
POST /admin/api/2020-10/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com",
"test": true
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262353,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": true,
"created_at": "2021-02-05T20:36:13-05:00",
"updated_at": "2021-02-05T20:36:13-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262353",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262353/confirm_application_charge?signature=BAh7BzoHaWRpBBExojw6EmF1dG9fYWN0aXZhdGVU--48f2976b86209785e94e1fd6d3d47141d1513fe9"
}
}
Trying to create a charge without a price or name will return an error
POST /admin/api/2020-10/application_charges.json
{
"application_charge": {
"name": ""
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"name": [
"can't be blank"
],
"price": [
"must be greater than or equal to 0.5"
]
}
}
Trying to create a charge with a price less than 0.50 will return an error
POST /admin/api/2020-10/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 0.4,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"price": [
"must be greater than or equal to 0.5"
]
}
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve an application charge
GET /admin/api/2020-10/application_charges/675931192.json
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
since_id
|
Restrict results to after the specified ID. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve all application charges
GET /admin/api/2020-10/application_charges.json
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
},
{
"id": 556467234,
"name": "Green theme",
"api_client_id": 755357713,
"price": "120.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "theme",
"decorated_return_url": "http://google.com?charge_id=556467234"
},
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
]
}
Retrieve all application charges since a specified ID
GET /admin/api/2020-10/application_charges.json?since_id=556467234
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
},
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
}
]
}
Activate an application charge
POST /admin/api/2020-10/application_charges/675931192/activate.json
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "active",
"return_url": "http://google.com/",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:36:06-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com/?charge_id=675931192"
}
}
The ApplicationCharge resource facilitates one-time charges. This type of charge is recommended for apps that aren’t billed on a recurring basis. You can create an application charge by sending a request with the name the charge should appear under, the price your app is charging, and a return URL where Shopify redirects the merchant after the charge is accepted. After you've created the charge, redirect the merchant to the confirmation URL returned by Shopify. If the charge is declined, then Shopify redirects the merchant and provides a notification message that the app charge was declined. For step-by-step guidance that walks through this flow using examples, see our implementation guide.
Note
For testing purposes you can include "test": true
when creating the charge. This prevents the credit card from being charged.
Test shops and demo shops can't be charged.
What you can do with ApplicationCharge
The Shopify API lets you do the following with the ApplicationCharge resource. More detailed versions of these general actions may be available:
- POST /admin/api/2021-01/application_charges.json Creates an application charge
- GET /admin/api/2021-01/application_charges/{application_charge_id}.json Retrieves an application charge
- GET /admin/api/2021-01/application_charges.json Retrieves a list of application charges
ApplicationCharge properties
confirmation_url |
The URL where the merchant accepts or declines the application charge. |
created_at |
The date and time (ISO 8601 format) when the application charge was created. |
id |
The ID of the application charge. |
name |
The application charge name. |
price |
The price of the application charge. The minimum price is 0.50, and maximum price is 10,000. |
return_url |
The URL where the merchant is redirected after accepting a charge. |
status |
The status of the application charge. Valid values:
|
test |
Whether the application charge is a test transaction. Valid values: |
updated_at |
The date and time (ISO 8601 format) when the charge was last updated. |
Endpoints
Create an application charge
POST /admin/api/2021-01/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262352,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": null,
"created_at": "2021-02-05T20:36:11-05:00",
"updated_at": "2021-02-05T20:36:11-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262352",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262352/confirm_application_charge?signature=BAh7BzoHaWRpBBAxojw6EmF1dG9fYWN0aXZhdGVU--f83da2d90a5af2a1484196a5e701764b0dbe10d6"
}
}
Create a test charge that will not cause a credit card to be charged
POST /admin/api/2021-01/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com",
"test": true
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262353,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": true,
"created_at": "2021-02-05T20:36:13-05:00",
"updated_at": "2021-02-05T20:36:13-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262353",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262353/confirm_application_charge?signature=BAh7BzoHaWRpBBExojw6EmF1dG9fYWN0aXZhdGVU--48f2976b86209785e94e1fd6d3d47141d1513fe9"
}
}
Trying to create a charge without a price or name will return an error
POST /admin/api/2021-01/application_charges.json
{
"application_charge": {
"name": ""
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"name": [
"can't be blank"
],
"price": [
"must be greater than or equal to 0.5"
]
}
}
Trying to create a charge with a price less than 0.50 will return an error
POST /admin/api/2021-01/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 0.4,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"price": [
"must be greater than or equal to 0.5"
]
}
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve an application charge
GET /admin/api/2021-01/application_charges/675931192.json
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
since_id
|
Restrict results to after the specified ID. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve all application charges
GET /admin/api/2021-01/application_charges.json
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
},
{
"id": 556467234,
"name": "Green theme",
"api_client_id": 755357713,
"price": "120.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "theme",
"decorated_return_url": "http://google.com?charge_id=556467234"
},
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
]
}
Retrieve all application charges since a specified ID
GET /admin/api/2021-01/application_charges.json?since_id=556467234
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
},
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
}
]
}
The ApplicationCharge resource facilitates one-time charges. This type of charge is recommended for apps that aren’t billed on a recurring basis. You can create an application charge by sending a request with the name the charge should appear under, the price your app is charging, and a return URL where Shopify redirects the merchant after the charge is accepted. After you've created the charge, redirect the merchant to the confirmation URL returned by Shopify. If the charge is declined, then Shopify redirects the merchant and provides a notification message that the app charge was declined. For step-by-step guidance that walks through this flow using examples, see our implementation guide.
Note
For testing purposes you can include "test": true
when creating the charge. This prevents the credit card from being charged.
Test shops and demo shops can't be charged.
What you can do with ApplicationCharge
The Shopify API lets you do the following with the ApplicationCharge resource. More detailed versions of these general actions may be available:
- POST /admin/api/2021-04/application_charges.json Creates an application charge
- GET /admin/api/2021-04/application_charges/{application_charge_id}.json Retrieves an application charge
- GET /admin/api/2021-04/application_charges.json Retrieves a list of application charges
ApplicationCharge properties
confirmation_url |
The URL where the merchant accepts or declines the application charge. |
created_at |
The date and time (ISO 8601 format) when the application charge was created. |
id |
The ID of the application charge. |
name |
The application charge name. |
price |
The price of the application charge. The minimum price is 0.50, and maximum price is 10,000. |
return_url |
The URL where the merchant is redirected after accepting a charge. |
status |
The status of the application charge. Valid values:
|
test |
Whether the application charge is a test transaction. Valid values: |
updated_at |
The date and time (ISO 8601 format) when the charge was last updated. |
Endpoints
Create an application charge
POST /admin/api/2021-04/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262352,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": null,
"created_at": "2021-02-05T20:36:11-05:00",
"updated_at": "2021-02-05T20:36:11-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262352",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262352/confirm_application_charge?signature=BAh7BzoHaWRpBBAxojw6EmF1dG9fYWN0aXZhdGVU--f83da2d90a5af2a1484196a5e701764b0dbe10d6"
}
}
Create a test charge that will not cause a credit card to be charged
POST /admin/api/2021-04/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com",
"test": true
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262353,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": true,
"created_at": "2021-02-05T20:36:13-05:00",
"updated_at": "2021-02-05T20:36:13-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262353",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262353/confirm_application_charge?signature=BAh7BzoHaWRpBBExojw6EmF1dG9fYWN0aXZhdGVU--48f2976b86209785e94e1fd6d3d47141d1513fe9"
}
}
Trying to create a charge without a price or name will return an error
POST /admin/api/2021-04/application_charges.json
{
"application_charge": {
"name": ""
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"name": [
"can't be blank"
],
"price": [
"must be greater than or equal to 0.5"
]
}
}
Trying to create a charge with a price less than 0.50 will return an error
POST /admin/api/2021-04/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 0.4,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"price": [
"must be greater than or equal to 0.5"
]
}
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve an application charge
GET /admin/api/2021-04/application_charges/675931192.json
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
since_id
|
Restrict results to after the specified ID. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve all application charges
GET /admin/api/2021-04/application_charges.json
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
},
{
"id": 556467234,
"name": "Green theme",
"api_client_id": 755357713,
"price": "120.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "theme",
"decorated_return_url": "http://google.com?charge_id=556467234"
},
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
]
}
Retrieve all application charges since a specified ID
GET /admin/api/2021-04/application_charges.json?since_id=556467234
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
},
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
}
]
}
The ApplicationCharge resource facilitates one-time charges. This type of charge is recommended for apps that aren’t billed on a recurring basis. You can create an application charge by sending a request with the name the charge should appear under, the price your app is charging, and a return URL where Shopify redirects the merchant after the charge is accepted. After you've created the charge, redirect the merchant to the confirmation URL returned by Shopify. If the charge is declined, then Shopify redirects the merchant and provides a notification message that the app charge was declined. For step-by-step guidance that walks through this flow using examples, see our implementation guide.
Note
For testing purposes you can include "test": true
when creating the charge. This prevents the credit card from being charged.
Test shops and demo shops can't be charged.
What you can do with ApplicationCharge
The Shopify API lets you do the following with the ApplicationCharge resource. More detailed versions of these general actions may be available:
- POST /admin/api/unstable/application_charges.json Creates an application charge
- GET /admin/api/unstable/application_charges/{application_charge_id}.json Retrieves an application charge
- GET /admin/api/unstable/application_charges.json Retrieves a list of application charges
ApplicationCharge properties
confirmation_url |
The URL where the merchant accepts or declines the application charge. |
created_at |
The date and time (ISO 8601 format) when the application charge was created. |
id |
The ID of the application charge. |
name |
The application charge name. |
price |
The price of the application charge. The minimum price is 0.50, and maximum price is 10,000. |
return_url |
The URL where the merchant is redirected after accepting a charge. |
status |
The status of the application charge. Valid values:
|
test |
Whether the application charge is a test transaction. Valid values: |
updated_at |
The date and time (ISO 8601 format) when the charge was last updated. |
Endpoints
Create an application charge
POST /admin/api/unstable/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262352,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": null,
"created_at": "2021-02-05T20:36:11-05:00",
"updated_at": "2021-02-05T20:36:11-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262352",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262352/confirm_application_charge?signature=BAh7BzoHaWRpBBAxojw6EmF1dG9fYWN0aXZhdGVU--f83da2d90a5af2a1484196a5e701764b0dbe10d6"
}
}
Create a test charge that will not cause a credit card to be charged
POST /admin/api/unstable/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 100.0,
"return_url": "http://super-duper.shopifyapps.com",
"test": true
}
}
View Response
HTTP/1.1 201 Created
{
"application_charge": {
"id": 1017262353,
"name": "Super Duper Expensive action",
"api_client_id": 755357713,
"price": "100.00",
"status": "pending",
"return_url": "http://super-duper.shopifyapps.com/",
"test": true,
"created_at": "2021-02-05T20:36:13-05:00",
"updated_at": "2021-02-05T20:36:13-05:00",
"charge_type": null,
"decorated_return_url": "http://super-duper.shopifyapps.com/?charge_id=1017262353",
"confirmation_url": "https://apple.myshopify.com/admin/charges/1017262353/confirm_application_charge?signature=BAh7BzoHaWRpBBExojw6EmF1dG9fYWN0aXZhdGVU--48f2976b86209785e94e1fd6d3d47141d1513fe9"
}
}
Trying to create a charge without a price or name will return an error
POST /admin/api/unstable/application_charges.json
{
"application_charge": {
"name": ""
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"name": [
"can't be blank"
],
"price": [
"must be greater than or equal to 0.5"
]
}
}
Trying to create a charge with a price less than 0.50 will return an error
POST /admin/api/unstable/application_charges.json
{
"application_charge": {
"name": "Super Duper Expensive action",
"price": 0.4,
"return_url": "http://super-duper.shopifyapps.com"
}
}
View Response
HTTP/1.1 422 Unprocessable Entity
{
"errors": {
"price": [
"must be greater than or equal to 0.5"
]
}
}
fields
|
A comma-separated list of fields to include in the response. |
Retrieve an application charge
GET /admin/api/unstable/application_charges/675931192.json
View Response
HTTP/1.1 200 OK
{
"application_charge": {
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
}
since_id
|
Restrict results to after the specified ID. |
fields
|
A comma-separated list of fields to include in the response. |
Retrieve all application charges
GET /admin/api/unstable/application_charges.json
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
},
{
"id": 556467234,
"name": "Green theme",
"api_client_id": 755357713,
"price": "120.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "theme",
"decorated_return_url": "http://google.com?charge_id=556467234"
},
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
}
]
}
Retrieve all application charges since a specified ID
GET /admin/api/unstable/application_charges.json?since_id=556467234
View Response
HTTP/1.1 200 OK
{
"application_charges": [
{
"id": 675931192,
"name": "iPod Cleaning",
"api_client_id": 755357713,
"price": "5.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": null,
"decorated_return_url": "http://google.com?charge_id=675931192"
},
{
"id": 1017262346,
"name": "Create me a logo",
"api_client_id": 755357713,
"price": "123.00",
"status": "accepted",
"return_url": "http://google.com",
"test": null,
"created_at": "2021-02-05T20:05:52-05:00",
"updated_at": "2021-02-05T20:05:52-05:00",
"charge_type": "brokered_service",
"decorated_return_url": "http://google.com?charge_id=1017262346"
}
]
}