# RecurringApplicationCharge
The RecurringApplicationCharge resource facilitates a fixed-value, 30-day recurring charge. 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 testing purposes you can include "test": true
when creating the charge. This prevents the credit card from being charged.
Test shops and demo shops cannot be charged.
Each shop can have only one recurring charge per app. When a new recurring application charge is activated for a shop that already has one, the existing recurring charge is canceled and replaced by the new charge. The new recurring charge is then activated.
For example, if you want to offer discounted pricing to a specific merchant, then you can create a new application charge for the shop. This will prompt the shop to accept the new charge in order to continue using the app. The new charge replaces the old billing going forward.
## Resource Properties ### RecurringApplicationCharge * activated_on: The date and time (ISO 8601 format) when the customer activated the recurring application charge.null
.
* Type: x-string
* Example: nil
* billing_on: The date and time (ISO 8601 format) when the customer is billed.null
.
* Type: x-string
* Example: nil
* cancelled_on: The date and time (ISO 8601 format) when the merchant canceled their recurring application charge.null
when the recurring application charge is not canceled.
* Type: x-string
* Example: nil
* capped_amount: The limit a customer can be charged for usage based billing. If this property is provided, then you must also provide the terms
property. See usage charges for more information.
* Type: x-string
* Example: "100"
* confirmation_url: The URL where the merchant accepts or declines the recurring application charge.
* Type: x-string
* Example: "https://jsmith.myshopify.com/admin/charges/confirm_recurring_application_charge?id=654381177&signature=BAhpBHkQASc%3D--374c02da2ea0371b23f40781b8a6d5f4a520e77b"
* created_at: The date and time (ISO 8601 format) when the recurring application charge was created.
* Type: x-string
* Example: "2013-06-27T08:48:27-04:00"
* id: The ID of the recurring application charge.
* Type: x-string
* Example: 675931192
* name: The name of the recurring application charge.
* Type: x-string
* Example: "Super Duper Expensive action"
* price: The price of the recurring application charge. The maximum price is 10,000.
* Type: x-string
* Example: "100.00"
* return_url: The URL where the merchant is redirected after accepting the charge.
* Type: x-string
* Example: "http://super-duper.shopifyapps.com"
* status: The status of the recurring charge. Valid values:
pending
to active
.pending
to active
.capped_amount
property is provided.
Presented to the merchant when they approve an app's usage charges.
* Type: x-string
* Example: "$1 for 1000 emails"
* test: Whether the application charge is a test transaction. Valid values: true
,null
.
* Type: x-string
* Example: nil
* trial_days: The number of days that the customer is eligible for a free trial.
* Type: x-string
* Example: 0
* trial_ends_on: The date and time (ISO 8601 format) when the free trial ends.
* Type: x-string
* Example: nil
* updated_at: The date and time (ISO 8601 format) when the recurring application charge was last updated.
* Type: x-string
* Example: "2013-06-27T08:48:27-04:00"
* currency: The currency of the price of the recurring application charge.
* Type: x-string
* Example: "USD"
## Creates a recurring application charge
Creates a recurring application charge. Make sure to include a valid return_url
property to ensure the merchant is redirected after accepting the charge (an invalid or missing return_url
property may lead to unstable behaviour in the charge approval flow).
### Endpoint
/admin/api/#{api_version}/recurring_application_charges.json (POST)
### Parameters
* api_version (required):
### Responses
#### 201
Creates a recurring application charge
Examples:
##### Create a new charge with a trial period. The trial period will go into effect at the time the recurring charge is activated.
Request:
```
POST /admin/api/unstable/recurring_application_charges.json
{"recurring_application_charge":{"name":"Super Duper Plan","price":10.0,"return_url":"http://super-duper.shopifyapps.com","trial_days":5}}
```
Response:
```
HTTP/1.1 201 Created
{"recurring_application_charge":{"id":1029266953,"name":"Super Duper Plan","price":"10.00","billing_on":null,"status":"pending","created_at":"2024-09-30T15:49:06-04:00","updated_at":"2024-09-30T15:49:06-04:00","activated_on":null,"return_url":"http://super-duper.shopifyapps.com/","test":null,"cancelled_on":null,"trial_days":5,"trial_ends_on":null,"api_client_id":755357713,"decorated_return_url":"http://super-duper.shopifyapps.com/?charge_id=1029266953","confirmation_url":"https://jsmith.myshopify.com/admin/charges/755357713/1029266953/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBAleWT06EmF1dG9fYWN0aXZhdGVU--3ff75f4af39200440bfaa8884000935f12459da5","currency":"USD"}}
```
##### Create a new charge with terms and a capped amount
Request:
```
POST /admin/api/unstable/recurring_application_charges.json
{"recurring_application_charge":{"name":"Super Duper Plan","price":10.0,"return_url":"http://super-duper.shopifyapps.com","capped_amount":100,"terms":"$1 for 1000 emails"}}
```
Response:
```
HTTP/1.1 201 Created
{"recurring_application_charge":{"id":1029266948,"name":"Super Duper Plan","price":"10.00","billing_on":null,"status":"pending","created_at":"2024-09-30T15:48:57-04:00","updated_at":"2024-09-30T15:48:57-04:00","activated_on":null,"return_url":"http://super-duper.shopifyapps.com/","test":null,"cancelled_on":null,"trial_days":0,"trial_ends_on":null,"api_client_id":755357713,"decorated_return_url":"http://super-duper.shopifyapps.com/?charge_id=1029266948","capped_amount":"100.00","balance_used":0,"balance_remaining":"100.00","risk_level":0,"confirmation_url":"https://jsmith.myshopify.com/admin/charges/755357713/1029266948/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBAReWT06EmF1dG9fYWN0aXZhdGVU--b35c9e930b9b572f33d60b1d6a2f6f12fe497ddc","currency":"USD"}}
```
##### Create a recurring application charge
Request:
```
POST /admin/api/unstable/recurring_application_charges.json
{"recurring_application_charge":{"name":"Super Duper Plan","price":10.0,"return_url":"http://super-duper.shopifyapps.com"}}
```
Response:
```
HTTP/1.1 201 Created
{"recurring_application_charge":{"id":1029266952,"name":"Super Duper Plan","price":"10.00","billing_on":null,"status":"pending","created_at":"2024-09-30T15:49:04-04:00","updated_at":"2024-09-30T15:49:04-04:00","activated_on":null,"return_url":"http://super-duper.shopifyapps.com/","test":null,"cancelled_on":null,"trial_days":0,"trial_ends_on":null,"api_client_id":755357713,"decorated_return_url":"http://super-duper.shopifyapps.com/?charge_id=1029266952","confirmation_url":"https://jsmith.myshopify.com/admin/charges/755357713/1029266952/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBAheWT06EmF1dG9fYWN0aXZhdGVU--10842299e62385bfe91445f274319595cf23992b","currency":"USD"}}
```
##### Create a recurring test charge that will not cause a credit card to be charged
Request:
```
POST /admin/api/unstable/recurring_application_charges.json
{"recurring_application_charge":{"name":"Super Duper Plan","price":10.0,"return_url":"http://super-duper.shopifyapps.com","test":true}}
```
Response:
```
HTTP/1.1 201 Created
{"recurring_application_charge":{"id":1029266951,"name":"Super Duper Plan","price":"10.00","billing_on":null,"status":"pending","created_at":"2024-09-30T15:49:01-04:00","updated_at":"2024-09-30T15:49:01-04:00","activated_on":null,"return_url":"http://super-duper.shopifyapps.com/","test":true,"cancelled_on":null,"trial_days":0,"trial_ends_on":null,"api_client_id":755357713,"decorated_return_url":"http://super-duper.shopifyapps.com/?charge_id=1029266951","confirmation_url":"https://jsmith.myshopify.com/admin/charges/755357713/1029266951/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBAdeWT06EmF1dG9fYWN0aXZhdGVU--7206e26a3c0d1795f75623590defcc137c44114e","currency":"USD"}}
```
#### 422
Creates a recurring application charge
Examples:
##### Trying to create a charge without a price and name will return an error
Request:
```
POST /admin/api/unstable/recurring_application_charges.json
{"recurring_application_charge":{"name":""}}
```
Response:
```
HTTP/1.1 422 Unprocessable Entity
{"errors":{"name":["can't be blank"],"price":["must be greater than zero"]}}
```
## Retrieves a list of recurring application charges
Retrieves a list of recurring application charges
### Endpoint
/admin/api/#{api_version}/recurring_application_charges.json (GET)
### Parameters
* api_version (required):
* fields: A comma-separated list of fields to include in the response.
* since_id: Restrict results to after the specified ID.
### Responses
#### 200
Retrieves a list of recurring application charges
Examples:
##### Retrieve all recurring application charges
Request:
```
GET /admin/api/unstable/recurring_application_charges.json
```
Response:
```
HTTP/1.1 200 OK
{"recurring_application_charges":[{"id":455696195,"name":"Super Mega Plan","price":"15.00","billing_on":"2024-09-30","status":"accepted","created_at":"2024-09-30T15:48:38-04:00","updated_at":"2024-09-30T15:49:00-04:00","activated_on":null,"return_url":"http://yourapp.example.org","test":null,"cancelled_on":null,"trial_days":0,"trial_ends_on":null,"api_client_id":755357713,"decorated_return_url":"http://yourapp.example.org?charge_id=455696195","currency":"USD"}]}
```
##### Retrieve all recurring charges since a specified ID
Request:
```
GET /admin/api/unstable/recurring_application_charges.json
```
Response:
```
HTTP/1.1 200 OK
{"recurring_application_charges":[{"id":1029266947,"name":"Super Duper Plan","price":"10.00","billing_on":null,"status":"pending","created_at":"2024-09-30T15:48:56-04:00","updated_at":"2024-09-30T15:48:56-04:00","activated_on":null,"return_url":"http://super-duper.shopifyapps.com/","test":null,"cancelled_on":null,"trial_days":0,"trial_ends_on":null,"api_client_id":755357713,"decorated_return_url":"http://super-duper.shopifyapps.com/?charge_id=1029266947","confirmation_url":"https://jsmith.myshopify.com/admin/charges/755357713/1029266947/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBANeWT06EmF1dG9fYWN0aXZhdGVU--6dba2deccf2730a705bf94af6da82c177ed72ca9","currency":"USD"}]}
```
## Retrieves a single charge
Retrieves a single charge
### Endpoint
/admin/api/#{api_version}/recurring_application_charges/{recurring_application_charge_id}.json (GET)
### Parameters
* api_version (required):
* recurring_application_charge_id (required):
* fields: A comma-separated list of fields to include in the response.
### Responses
#### 200
Retrieves a single charge
Examples:
##### Retrieve a single charge
Request:
```
GET /admin/api/unstable/recurring_application_charges/455696195.json
```
Response:
```
HTTP/1.1 200 OK
{"recurring_application_charge":{"id":455696195,"name":"Super Mega Plan","price":"15.00","billing_on":"2024-09-30","status":"pending","created_at":"2024-09-30T15:48:38-04:00","updated_at":"2024-09-30T15:48:38-04:00","activated_on":null,"return_url":"http://yourapp.example.org","test":null,"cancelled_on":null,"trial_days":0,"trial_ends_on":null,"api_client_id":755357713,"decorated_return_url":"http://yourapp.example.org?charge_id=455696195","confirmation_url":"https://jsmith.myshopify.com/admin/charges/755357713/455696195/RecurringApplicationCharge/confirm_recurring_application_charge?signature=BAh7BzoHaWRpBENfKRs6EmF1dG9fYWN0aXZhdGVU--b5f90d04779cc5242b396e4054f2e650c5dace1c","currency":"USD"}}
```
## Cancels a recurring application charge
Cancels a recurring application charge
### Endpoint
/admin/api/#{api_version}/recurring_application_charges/{recurring_application_charge_id}.json (DELETE)
### Parameters
* api_version (required):
* recurring_application_charge_id (required):
### Responses
#### 200
Cancels a recurring application charge
Examples:
##### Cancel the current recurring charge for a shop
Request:
```
DELETE /admin/api/unstable/recurring_application_charges/455696195.json
```
Response:
```
HTTP/1.1 200 OK
```
## Updates the capped amount of a recurring application charge
Updates the capped amount of an active recurring application charge. Note that you cannot
use this endpoint to update any other proprty on a recurring application charge or the capped amount on
an Annual subscription.
### Endpoint
/admin/api/#{api_version}/recurring_application_charges/{recurring_application_charge_id}/customize.json?recurring_application_charge[capped_amount]=200 (PUT)
### Parameters
* api_version (required):
* recurring_application_charge_id (required):
### Responses
#### 200
Updates the capped amount of a recurring application charge
Examples:
##### Increase the capped amount for a shop
Request:
```
PUT /admin/api/unstable/recurring_application_charges/455696195/customize.json
```
Response:
```
HTTP/1.1 200 OK
{"recurring_application_charge":{"id":455696195,"name":"Super Mega Plan","price":"15.00","billing_on":null,"status":"active","created_at":"2024-09-30T15:48:38-04:00","updated_at":"2024-09-30T15:49:02-04:00","activated_on":"2024-09-30","return_url":"http://yourapp.example.org","test":null,"cancelled_on":null,"trial_days":0,"trial_ends_on":"2024-09-30","api_client_id":755357713,"decorated_return_url":"http://yourapp.example.org?charge_id=455696195","capped_amount":"100.00","balance_used":"0.0","balance_remaining":"100.00","risk_level":0,"update_capped_amount_url":"https://jsmith.myshopify.com/admin/charges/755357713/455696195/RecurringApplicationCharge/confirm_update_capped_amount?signature=BAh7BzoHaWRpBENfKRs6EmF1dG9fYWN0aXZhdGVG--136c3934bb6bc02c23d1582830bcdfdcb7806ac6","currency":"USD"}}
```