API Reference

The Recharge API is primarily a REST API with some RPC endpoints to support common operations. It has predictable, resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and methods.

Related guides: Generate API tokens, Using the API



API and Platforms compatibility

Recharge offers hosted solutions and integrates with various ecommerce platforms to process recurring transactions with the setup of your choice. In order to be compatible with those platforms some of our API resources and endpoints may be limited in use to a subset of platforms. When that is the case we will flag with the help of tags the checkout/platform association for which that feature is compatible.
When there is no restriction of compatibility no tags will appear.
Below is a legend of the tags you may come across:


Tag Checkout solution Ecommerce platform
BigCommerce Recharge hosted BigCommerce
Custom Recharge hosted or API-first Custom
RCS Recharge hosted Shopify
SCI Shopify hosted Shopify

You may also come across other tags specifying regional restrictions (e.g. USA Only) or new releases (e.g. Alpha, Beta).



Intro image
Base URL
https://api.rechargeapps.com

Authentication

Recharge uses API keys to authenticate requests.

Each request to the API should contain an API token in the following header:

X-Recharge-Access-Token:store_api_token

Replace store_api_token with your API key.

All requests must be made over HTTPS.


API Token Scopes

Scopes can be set up from the API token edit page in Recharge to control the level of access of an API token.

The API currently supports the scopes below:

Write Read
read_accounts
write_batches read_batches
write_customers read_customers
write_discounts read_discounts
read_events
write_notifications
write_orders read_orders
write_payment_methods read_payment_methods
write_products read_products
write_subscriptions read_subscriptions
read_store
read_credit_accounts
read_credit_adjustments
GET /
curl -i -H 'X-Recharge-Access-Token: your_api_token'
-X GET

Versioning

All requests will use your account API settings, unless you send a X-Recharge-Version header to specify the version.
You can use the same token to make calls to all versions. When no version is specified it will default to the default version on your store.

Existing API Versions Release notes
2021-11 2021-11 release notes
2021-01

Responses

Recharge uses conventional HTTP response codes to indicate the success or failure of an API request. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided ( e.g. a required parameter was omitted, a charge failed, etc ), and codes in the 5xx range indicate an error with Recharge’s servers.

200 - OK: Everything worked as expected.
201 - OK: The request was successful, created a new resource, and resource created is in the body.
202 - OK: The request has been accepted and is in processing.
204 - OK: The server has successfully fulfilled the request and there is no content to send in the response body.
400 - Bad Request: The request was unacceptable, often due to a missing required parameter.
401 - Unauthorized: No valid API key was provided.
402 - Request Failed: The parameters were valid but the request failed.
403 - The request was authenticated but not authorized for the requested resource (permission scope error).
404 - Not Found: The requested resource doesn’t exist.
405 - Method Not Allowed: The method is not allowed for this URI.
406 - The request was unacceptable, or requesting a data source which is not allowed although permissions permit the request.
409 - Conflict: You will get this error when you try to send two requests to edit an address or any of its child objects at the same time, in order to avoid out of date information being returned.
415 - The request body was not a JSON object.
422 - The request was understood but cannot be processed due to invalid or missing supplemental information.
426 - The request was made using an invalid API version.
429 - The request has been rate limited.
500 - Internal server error.
501 - The resource requested has not been implemented in the current version but may be implemented in the future.
503 - A 3rd party service on which the request depends has timed out.

Extending responses

Our API endpoints and webhooks allow developers to extend responses with additional data in order to optimize calls, allowing for simpler and more efficient implementations.

The API supports including additional objects when using a GET request to retrieve a list or a GET request to retrieve a record by a specific id. This is achieved by using an include query parameter in the request URL. The include value contains the object or objects you want to include in the response of your request. On routes where multiple includes are available, you are able to pass multiple values separated by a comma (include=customer,metafields). The below table defines available include values for commonly used resources of the API.

Webhooks support included_objects on the topics listed below. Webhook included_objects accepts an array of supported values ("included_objects": [ "customer", "metafields"]). Specifying included_objects will return an enriched payload, containing the original resource and the associated included objects.

Resource Endpoints Webhook topics Supported include values Supported included_objects values
Addresses GET /addresses
GET /addresses/:id
address/created
address/updated
customer
discount
payment_methods (beta)
subscriptions
customer
metafields
Charges GET /charges
GET /charges/:id
charge/created
charge/failed
charge/max_retries_reached
charge/paid
charge/refunded
charge/uncaptured
charge/upcoming
charge/updated
metafields metafields
Customers GET /customers
GET /customers/:id
customer/activated
customer/created
customer/deactivated
customer/payment_method_updated
customer/updated
addresses
metafields
payment_methods (beta)
subscriptions
addresses
metafields
Orders GET /orders
GET /orders/:id
order/cancelled
order/created
order/deleted
order/processed
order/upcoming
order/updated
customer
metafields
customer
metafields
Products GET /products
GET /products/:id
product/created
product/deleted
product/updated
collections
metafields
collections
metafields
Subscriptions GET /subscriptions
GET /subscriptions/:id
subscription/activated
subscription/cancelled
subscription/created
subscription/deleted
subscription/skipped
subscription/updated
subscription/unskipped
subscription/paused
address
metafields
metafields

Page Based Pagination

By default API calls will return 50 results. By using the limit parameter that can be increased to 250 results.

When there are more results than can fit on a page you may loop through the results by using the page parameter.

To request a page, include page as a parameter in the url.

E.g. https://api.rechargeapps.com/subscriptions?limit=250&page=1

The example to the right shows a loop through all Subscription by page.

With minor changes this example can be used for looping through any object type: Customers, Addresses etc.


NOTE:
Page based pagination deep into large data sets is not recommended due to performance degradation. To paginate deeper into a data set, we recommend exploring cursor pagination instead.
Example Request
# request the first page (page=1)
curl -i -H 'X-Recharge-Access-Token: your_api_token'
 -X GET https://api.rechargeapps.com/subscriptions?limit=250&page=1
# request next page of results (page=2)
curl -i -H 'X-Recharge-Access-Token: your_api_token'
 -X GET https://api.rechargeapps.com/subscriptions?limit=250&page=2
Example Response
id: 123
id: 456
# ... continues through 250 records
page: 1 result_size: 250

id: 567
id: 678
# ... continues through 250 records
page: 2 result_size: 250

id: 567
id: 678
# ... continues through only 10 records, no further pages needed
page: 3 result_size: 10

Cursor Pagination

By default API calls will return 50 results. By using the limit parameter that can be increased to 250 results. When there are more results than the current limit a cursor may be used to request additional results.

Cursor based pagination is the preferred method for looping through all records in a given data set, as it is more performant than specifying a page number along with number of results. This method also provides more assurance that you will receive all of the records in a given set.

Cursor based pagination works by providing a reference to a specific item in a list of sequential data which will represent the cursor, such as a numeric id. You can then specify whether you would like to query records starting before or starting after that item.

For convenience, the API provides a Link header in all responses for which there are further pages. This header contains both a next_cursor and previous_cursor link, which is just a URL with an encoded page_info parameter that contains any filters from your first call, as well as markers to let the API know where it left off and where to begin for the next call.

Please note that the only compatible filter allowed to be used with cursors is limit.


Supported endpoints for Link
GET /addresses
GET /async_batches
GET /async_batches/:id/tasks
GET /charges
GET /customers
GET /discounts
GET /orders
GET /products
GET /subscriptions

NOTE:
/charges requests which supply either the updated_at_min or created_at_min filter will not currently return a Link header.
Requests which contain a filter for ids, shopify_product_ids will not return a Link header.
Example Request
URL="https://api.rechargeapps.com/charges?limit=5"

response=$(curl -s -w "%{http_code}" 
    -H 'X-Recharge-Access-Token: your_api_token'  
    -H 'X-Recharge-Version: 2021-11'  
    -X GET $URL)

 content=$(sed '$ d' <<< "$response") # get all but the last line which contains the status code

# Display results
echo $content | jq "."

# parse next url
echo "Next URL"
next_cursor=$(jq ".next_cursor" <<< "${content}")

# Notice next_cursor value is passed as page_info query param
echo "$URL&page_info=$next_cursor"

Sorting

The API supports sorting of results when using a GET request to retrieve a list. Sorting is achieved using a sort_by query parameter in the request URL. The sort_by value contains the parameter and sort direction for your results (ascending or descending), and available sort_by values vary between resources. The below table defines available sort_by options for commonly used resources.


Resource Supported sort_by_values
Address Default: id-desc
Options: id-asc id-desc updated_at-asc updated_at-desc
Async Batch Default: id-desc
Options: id-asc id-desc created_at-asc created_at-desc
Charge Default: id-asc
Options: id-asc id-desc created_at-asc created_at-desc updated_at-asc updated_at-desc charge_date-asc charge_date-desc
Customer Default: id-desc
Options: id-asc id-desc created_at-asc created_at-desc updated_at-asc updated_at-desc
Discount Default: id-desc
Options: id-asc id-desc created_at-asc created_at-desc updated_at-asc updated_at-desc
Metafield Default: id-desc
Options:id-asc id-desc updated_at-asc updated_at-desc
Onetime Default: id-desc
Options: id-asc id-desc created_at-asc created_at-desc updated_at-asc updated_at-desc
Order Default: id-desc
Options: id-asc id-desc created_at-asc created_at-desc shipped_date-asc shipped_date-desc shipping_date-asc shipping_date-desc updated_at-asc updated_at-desc
Product Default: id-desc
Options: id-asc id-desc created_at-asc created_at-desc updated_at-asc updated_at-desc title-asc title-desc
Subscription Default: id-desc
Options: id-asc id-desc created_at-asc created_at-desc updated_at-asc updated_at-desc
Webhook Default: id-desc
Options: id-asc id-desc

Addresses

Addresses represents one of the many shipping locations a customer may have. Subscriptions are tied to a given address. Each customer can have multiple address objects (many to one aka n:1) in the relationship.

Endpoints
POST
/customers/{id}/addresses
GET
/addresses/{id}
PUT
/addresses/{id}
DELETE
/addresses/{id}
GET
/addresses
GET
/addresses/count
POST
/addresses/validate

Charges

A charge is the representation of a financial transaction linked to the purchase of an item (past or future). It can be a transaction that was processed already or the representation of an upcoming transaction. A charge is linked to its corresponding Orders( one Order for pay as you go subscriptions and several for pre-paid). Order are created once the corresponding Charge is successful. After successful payment, the first order will be immediately submitted to the external platform if applicable (e.g. Shopify, BigCommerce).

Endpoints
GET
/charges/{id}
GET
/charges
GET
/charges/count
POST
/charges/{id}/change_next_charge_date
POST
/charges/{id}/skip
POST
/charges/{id}/unskip
POST
/charges/{id}/refund
POST
/charges/{id}/process
POST
/charges/{id}/capture_payment

Checkouts

The checkout resource allows to create unique checkout experiences.
We currently support Stripe, Apple Pay, Google Pay, and Braintree as payment processor.

Related guides: Mobile payments

Important - The Checkout endpoints are only available for BigCommerce and Custom. Checkouts on Shopify must go through Shopify.

Endpoints
POST
/checkouts
GET
/checkouts/{token}
POST
/checkouts
PUT
/checkouts/{token}
GET
/checkouts/{token}/shipping_rates
POST
/checkouts/{token}/charge

Customers

The Customer object holds account and billing information. Email is unique on the customer; no two customers for a store can have the same email. Address is the child of the customer object. There can be many child addresses on a customer, but only one parent customer per address.

Endpoints
POST
/customers
GET
/customers/{id}
PUT
/customers/{id}
DELETE
/customers/{id}
GET
/customers
GET
/customers/count
GET
/customers/{id}/payment_sources

Discounts

Discounts can be applied to checkout, or can be applied directly to an address. Depending on configuration they allow for single use, or recurring discounts.

Often discounts can be used combination with webhooks, such that when a specific event comes, it can apply a discount dependent on custom business logic.

There are various options that can be utilized for discounts such as minimum price, single use, recurring for a set number of charges, or ongoing. You can also set the date from which time the discount will become applicable begin, and when it can no longer be applied to a new subscription.

Endpoints
POST
/discounts
GET
/discounts/{id}
PUT
/discounts/{id}
DELETE
/discounts/{id}
GET
/discounts
GET
/discounts/count
POST
/addresses/{id}/apply_discount
POST
/charges/{id}/apply_discount
POST
/addresses/{id}/remove_discount

Metafields

We now have metafields endpoint on our API!

Metafields feature allows you to add additional information to other resources. They can be used for adding custom fields to objects, and are useful for storing specialized information.

Endpoints
POST
/metafields
GET
/metafields/{id}
PUT
/metafields/{id}
DELETE
/metafields/{id}
GET
/metafields
GET
/metafields/count

Notifications

The Customer Notifications API is used to dispatch email notifications to customers within Recharge. The API uses your configured Recharge email templates, and will dispatch an email to the address associated with the indicated customer_id. Some email templates require variable values, which are sent through the Customer Notifications API via the template_vars attribute. See below examples for all available template types.

Currently, the Customer Notifications API can be used to dispatch Get Account Access, and Upcoming Charge emails. Support for additional email templates and message types will be added in the future. To view your email template configurations, see the Notifications Settings section in your Recharge Merchant Portal.

Endpoints
POST
/customers/{id}/notifications

Onetimes

Onetimes represent non-recurring line items on a QUEUED Charge.

Endpoints
POST
/addresses/{address_id}/onetimes
GET
/onetimes/{id}
PUT
/onetimes/{id}
DELETE
/onetimes/{id}
GET
/onetimes

Orders

An order is created after a charge is successfully processed. The order contains all the same json data as the charge. In case of a prepaid order creation, the order will be queued for a particular date and submitted on that date to shopify.

Endpoints
GET
/orders/{id}
PUT
/orders/{id}
DELETE
/orders/{id}
GET
/orders
GET
/orders/count
POST
/orders/{id}/change_date
PUT
/orders/{id}/update_shopify_variant/{remote_variant_id}
POST
/orders/clone_order_on_success_charge/{order_id}/charge/{charge_id}
POST
/orders/{id}/delay

The order object

These fields are deprecated, however they will not be removed from this API version.
product_title is deprecated. Use title instead.
shipping_date is deprecated. Use scheduled_at instead.
shopify_id is deprecated. Use shopify_order_id instead.
address_is_active is deprecated. Please ignore, not an applicable field.

Attributes
  • id
    integer

    The unique numeric identifier for the order.

  • billing_address
    object

    The billing address at the time the order was created. See addresses for detailed address information.

  • currency
    string

    The currency of the payment used to create the order.

  • customer
    object

    Object that contains information about the customer.

  • email
    string

    The email address of the customer.

  • first_name
    string

    The first name of the customer.

  • is_prepaid
    boolean

    The order that has been paid for a pre-determined number of months. 0=No, 1=Yes.

  • last_name
    string

    The last name of the customer.

  • line_items
    array

    A list of line item objects, each one containing information about an item in the order.

  • payment_processor
    string

    The type of payment the processor has chosen.

  • processed_at
    string

    The date when the order was submitted.

  • scheduled_at
    datetime

    The date when the order will be shipped.

  • shipping_address
    object

    The shipping address where the order will be shipped. See addresses for detailed address information.

  • shopify_cart_token
    string

    Unique cart token generated by Shopify when an item is added to the cart.

  • shopify_customer_id
    integer

    Unique numeric identifier within Shopify for the customer.

  • shopify_order_id
    integer

    Unique numeric identifier within Shopify for the order.

  • shopify_order_number
    integer

    The unique order number within Shopify.

  • status
    string

    The status of creating the order within Shopify.

  • transaction_id
    string

    The unique alphanumeric identifier of the transaction.

  • total_price
    integer

    The sum of all of the prices of the items in the order with taxes and discounts included (must be positive).

  • total_duties
    string

    The total cost of duties for the order.

  • type
    string

    Shows if order was made thorough checkout or if it’s a recurring charge. Inputs: “CHECKOUT” or “RECURRING”.

Error related attributes
  • error
    string

    String describing the reason for the error state.

More Attributes
  • address_id
    integer

    The id of the customer shipping address that this order is tied to.

  • address_is_active
    boolean

    Tells if address is currently active. 0=No, 1=Yes.
    Deprecated. Not an applicable field.

  • charge_id
    integer

    The unique numeric identifier of the charge.

  • created_at
    datetime

    The date when the order was created.

  • customer_id
    integer

    The unique numeric identifier of the customer.

  • shipping_date
    datetime

    The date when the order will be processed.
    Use scheduled_at instead.

  • shopify_id
    string

    Unique numeric identifier within Shopify for the order.
    Deprecated, use shopify_order_id instead.

  • updated_at
    datetime

    The date when the order was last updated.

The order object
{
  "order": {
    "id": 70071255,
    "address_id": 4029306,
    "address_is_active": 1,
    "billing_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "charge_id": 97376832,
    "charge_status": "SUCCESS",
    "created_at": "2018-11-08T08:08:09",
    "currency": "USD",
    "customer": {
      "accepts_marketing": true,
      "email": "examlpe@email.com",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": null,
      "send_email_welcome": false,
      "verified_email": true
    },
    "customer_id": 4203912,
    "discount_codes": [],
    "email": "examlpe@email.com",
    "error": "",
    "first_name": "mike",
    "hash": "42039120ee0e6cfa5c97805",
    "is_prepaid": 1,
    "last_name": "flynn",
    "line_items": [
      {
        "external_inventory_policy": "decrement_obeying_policy",
        "images": {
          "large": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2_large.jpeg",
          "medium": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2_medium.jpeg",
          "original": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2.jpeg",
          "small": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2_small.jpeg"
        },
        "original_price": "17.00",
        "price": "17.00",
        "product_title": "Milk",
        "properties": [
          {
            "name": "grind",
            "value": "drip"
          },
          {
            "name": "size",
            "value": "medium"
          }
        ],
        "quantity": 4,
        "shopify_product_id": 1255183683,
        "shopify_variant_id": 3844924611,
        "sku": "MILK-1",
        "subscription_id": 26375706,
        "tax_lines": [
          {
            "price": "0.950",
            "rate": 0.0725,
            "title": "CA State Tax"
          },
          {
            "price": "0.335",
            "rate": 0.0225,
            "title": "Los Angeles  County Tax"
          }
        ],
        "title": "Milk",
        "variant_title": "Milk - a / b"
      }
    ],
    "note": "shopifyCartToken_littledata:45af6dbe140d8dc1a9b7821ae256cfff GAClientId:1215763073.1492751771 -  next order #3   - Subscription Recurring Order",
    "note_attributes": [],
    "payment_processor": "stripe",
    "processed_at": null,
    "scheduled_at": "2022-11-16T00:00:00",
    "shipped_date": null,
    "shipping_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "shipping_date": "2022-11-16T00:00:00",
    "shipping_lines": [
      {
        "code": "Standard Shipping",
        "price": 0,
        "title": "Standard Shipping"
      }
    ],
    "shopify_cart_token": "45af6dbe140d8dc1a9b7821ae256cfff",
    "shopify_customer_id": "6454896021",
    "shopify_id": null,
    "shopify_order_id": null,
    "shopify_order_number": null,
    "status": "CANCELLED",
    "subtotal_price": 0,
    "tags": "Prepaid, Subscription, Subscription Recurring Order",
    "tax_lines": [
      {
        "price": "0.950",
        "rate": 0.0725,
        "title": "CA State Tax"
      },
      {
        "price": "0.335",
        "rate": 0.0225,
        "title": "Los Angeles  County Tax"
      }
    ],
    "total_discounts": 0,
    "total_duties": 0,
    "total_line_items_price": 0,
    "total_price": 0,
    "total_refunds": null,
    "total_tax": 0,
    "total_weight": 18144,
    "transaction_id": "ch_1DUDEtJ2zqHvZRd1EQHjapRD",
    "type": "RECURRING",
    "updated_at": "2018-12-20T13:25:52"
  }
}

Retrieve an order

Retrieve one order using the Recharge order id.

Scopes: read_orders
Responses
  • 200

    Success

GET
/orders/{id}
curl 'https://api.rechargeapps.com/orders/70071255' \ 
 -H 'X-Recharge-Access-Token: your_api_token'
Response
{
  "order": {
    "id": 70071255,
    "address_id": 4029306,
    "address_is_active": 1,
    "billing_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "charge_id": 97376832,
    "charge_status": "SUCCESS",
    "created_at": "2018-11-08T08:08:09",
    "currency": "USD",
    "customer": {
      "accepts_marketing": true,
      "email": "examlpe@email.com",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": null,
      "send_email_welcome": false,
      "verified_email": true
    },
    "customer_id": 4203912,
    "discount_codes": [],
    "email": "examlpe@email.com",
    "error": "",
    "first_name": "mike",
    "hash": "42039120ee0e6cfa5c97805",
    "is_prepaid": 1,
    "last_name": "flynn",
    "line_items": [
      {
        "images": {
          "large": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2_large.jpeg",
          "medium": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2_medium.jpeg",
          "original": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2.jpeg",
          "small": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2_small.jpeg"
        },
        "original_price": "17.00",
        "price": "17.00",
        "properties": [
          {
            "name": "grind",
            "value": "drip"
          },
          {
            "name": "size",
            "value": "medium"
          }
        ],
        "quantity": 4,
        "shopify_product_id": 1255183683,
        "shopify_variant_id": 3844924611,
        "sku": "MILK-1",
        "subscription_id": 26375706,
        "variant_title": "Milk - a / b"
      }
    ],
    "note": "shopifyCartToken_littledata:45af6dbe140d8dc1a9b7821ae256cfff GAClientId:1215763073.1492751771 -  next order #3   - Subscription Recurring Order",
    "note_attributes": [],
    "payment_processor": "stripe",
    "processed_at": null,
    "scheduled_at": "2022-11-16T00:00:00",
    "shipped_date": null,
    "shipping_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "shipping_date": "2022-11-16T00:00:00",
    "shipping_lines": [
      {
        "code": "Standard Shipping",
        "price": 0,
        "title": "Standard Shipping"
      }
    ],
    "shopify_cart_token": "45af6dbe140d8dc1a9b7821ae256cfff",
    "shopify_customer_id": "6454896021",
    "shopify_id": null,
    "shopify_order_id": null,
    "shopify_order_number": null,
    "status": "CANCELLED",
    "subtotal_price": 0,
    "tags": "Prepaid, Subscription, Subscription Recurring Order",
    "tax_lines": [
      {
        "price": "0.950",
        "rate": 0.0725,
        "title": "CA State Tax"
      },
      {
        "price": "0.335",
        "rate": 0.0225,
        "title": "Los Angeles  County Tax"
      }
    ],
    "total_discounts": 0,
    "total_duties": 0,
    "total_line_items_price": 0,
    "total_price": 0,
    "total_refunds": null,
    "total_tax": 0,
    "total_weight": 18144,
    "transaction_id": "ch_1DUDEtJ2zqHvZRd1EQHjapRD",
    "type": "RECURRING",
    "updated_at": "2018-12-20T13:25:52"
  }
}

Update an order

Updating existing order is now available for pre-paid subscriptions.

Scopes: write_orders
Body Parameters
  • billing_address
    object

    The key values you would like to update:

    address1 optional
    province required
    address2 optional
    city optional
    company optional
    country optional
    first_name optional
    last_name optional
    phone optional
    zip optional

  • shipping_address
    object

    The key values you would like to update:

    address1 optional
    province required
    address2 optional
    city optional
    company optional
    country optional
    first_name optional
    last_name optional
    phone optional
    zip optional

  • customer
    object

    The key values related with customer you would like to update:

    first_name optional
    last_name required
    email optional

Responses
  • 200

    Success

PUT
/orders/{id}
curl -X PUT 'https://api.rechargeapps.com/orders/70071255' \ 
 -H 'Content-Type: application/json' \ 
 -H 'X-Recharge-Access-Token: your_api_token' \ 
 -d '{
"billing_address": {
  "city": "Los Angeles",
  "first_name": "mike",
  "last_name": "flynn",
  "zip": "90025"
 }
}'
Response
{
  "order": {
    "id": 70071255,
    "address_id": 4029306,
    "address_is_active": 1,
    "billing_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "charge_id": 97376832,
    "charge_status": "SUCCESS",
    "created_at": "2018-11-08T08:08:09",
    "currency": "USD",
    "customer": {
      "accepts_marketing": true,
      "email": "examlpe@email.com",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": null,
      "send_email_welcome": false,
      "verified_email": true
    },
    "customer_id": 4203912,
    "discount_codes": [],
    "email": "examlpe@email.com",
    "error": "",
    "first_name": "mike",
    "hash": "42039120ee0e6cfa5c97805",
    "is_prepaid": 1,
    "last_name": "flynn",
    "line_items": [
      {
        "external_inventory_policy": "decrement_obeying_policy",
        "images": {
          "large": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2_large.jpeg",
          "medium": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2_medium.jpeg",
          "original": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2.jpeg",
          "small": "https://cdn.shopify.com/s/files/1/0683/1951/products/milk2_small.jpeg"
        },
        "original_price": "17.00",
        "price": "17.00",
        "product_title": "Milk",
        "properties": [
          {
            "name": "grind",
            "value": "drip"
          },
          {
            "name": "size",
            "value": "medium"
          }
        ],
        "quantity": 4,
        "shopify_product_id": 1255183683,
        "shopify_variant_id": 3844924611,
        "sku": "MILK-1",
        "subscription_id": 26375706,
        "tax_lines": [
          {
            "price": "0.950",
            "rate": 0.0725,
            "title": "CA State Tax"
          },
          {
            "price": "0.335",
            "rate": 0.0225,
            "title": "Los Angeles  County Tax"
          }
        ],
        "title": "Milk",
        "variant_title": "Milk - a / b"
      }
    ],
    "note": "shopifyCartToken_littledata:45af6dbe140d8dc1a9b7821ae256cfff GAClientId:1215763073.1492751771 -  next order #3   - Subscription Recurring Order",
    "note_attributes": [],
    "payment_processor": "stripe",
    "processed_at": null,
    "scheduled_at": "2022-11-16T00:00:00",
    "shipped_date": null,
    "shipping_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "shipping_date": "2022-11-16T00:00:00",
    "shipping_lines": [
      {
        "code": "Standard Shipping",
        "price": 0,
        "title": "Standard Shipping"
      }
    ],
    "shopify_cart_token": "45af6dbe140d8dc1a9b7821ae256cfff",
    "shopify_customer_id": "6454896021",
    "shopify_id": null,
    "shopify_order_id": null,
    "shopify_order_number": null,
    "status": "CANCELLED",
    "subtotal_price": 0,
    "tags": "Prepaid, Subscription, Subscription Recurring Order",
    "tax_lines": [
      {
        "price": "0.950",
        "rate": 0.0725,
        "title": "CA State Tax"
      },
      {
        "price": "0.335",
        "rate": 0.0225,
        "title": "Los Angeles  County Tax"
      }
    ],
    "total_discounts": 0,
    "total_duties": 0,
    "total_line_items_price": 0,
    "total_price": 0,
    "total_refunds": null,
    "total_tax": 0,
    "total_weight": 18144,
    "transaction_id": "ch_1DUDEtJ2zqHvZRd1EQHjapRD",
    "type": "RECURRING",
    "updated_at": "2018-12-20T13:25:52"
  }
}

Delete an order

You can delete a scheduled order.

Scopes: write_orders
Responses
  • 200

    successful response

DELETE
/orders/{id}
curl -X DELETE 'https://api.rechargeapps.com/orders/70071255' \ 
 -H 'X-Recharge-Access-Token: your_api_token'
Response
{}

List orders

Returns a list of orders.


## HTTP request examples

GET /orders
GET /orders?customer_id=123
GET /orders?address_id=4587216
GET /orders?charge_id=45678542
GET /orders?created_at_min=2016-05-18&created_at_max=2016-06-18

Scopes: read_orders
Query Parameters
  • address_id
    string

    Filter orders by address.
    GET /orders/?address_id=123 will return all orders for the given address_id

  • charge_id
    string

    Filter orders by charge.
    GET /orders/?charge_id=123 will return all orders for the given charge_id

  • created_at_max
    string

    Show orders created before the given date.

  • created_at_min
    string

    Show orders created after the given date.

  • customer_id
    string

    Filter orders by customer.
    GET /orders/?customer_id=123 will return all orders for the given customer_id

  • ids
    string

    Filter orders by id. If passing multiple values, must be comma separated. Non-integer values will result in a 422 error

  • limit
    string

    Default: 50

    Max: 250

    The number of results. Default is 50, maximum is 250.

  • page
    string

    Default: 1

    The page to show. Default is 1.

  • scheduled_at_max
    string

    Show orders scheduled before the given date.

  • scheduled_at_min
    string

    Show orders scheduled after the given date.

  • shipping_date
    string

    The date when the order will be processed and sent to Shopify.
    Deprecated, use scheduled_at instead.

  • shopify_order_id
    string

    Filter orders by shopify_order_id.

  • has_external_order
    string

    Filter orders with/without shopify_order_id (external_order_id). Default value is null

  • status
    string

    Filter orders by status. Available status: “SUCCESS”, “QUEUED”, “ERROR”, “REFUNDED”, “SKIPPED”.

  • subscription_id
    string

    Filter orders by subscriptions.
    GET /orders/?subscription_id=123 will return all orders for the given subscription_id

  • updated_at_max
    string

    Show orders updated before the given date.

  • updated_at_min
    string

    Show orders updated after the given date.

Responses
  • 200

    successful response

GET
/orders
curl 'https://api.rechargeapps.com/orders' \ 
 -H 'X-Recharge-Access-Token: your_api_token' \ 
 -d limit=3 -G
Response
{
  "orders": [
    {
      "id": 70071255,
      "address_id": 4029306,
      "address_is_active": 1,
      "billing_address": {
        "address1": "1933 Manning",
        "address2": "204",
        "city": "los angeles",
        "company": "bootstrap",
        "country": "United States",
        "first_name": "mike",
        "last_name": "flynn",
        "phone": "3103103101",
        "province": "California",
        "zip": "90025"
      },
      "charge_id": 97376832,
      "charge_status": "SUCCESS",
      "created_at": "2018-11-08T08:08:09",
      "currency": "USD",
      "customer": {
        "accepts_marketing": true,
        "email": "examlpe@email.com",
        "first_name": "mike",
        "last_name": "flynn",
        "phone": null,
        "send_email_welcome": false,
        "verified_email": true
      },
      "customer_id": 4203912,
      "discount_codes": [],
      "email": "examlpe@email.com",
      "first_name": "mike",
      "hash": "42039120ee0e6cfa5c97805",
      "is_prepaid": 1,
      "last_name": "flynn",
      "line_items": [
        {
          "grams": 0,
          "images": {
            "large": "https://cdn.shopify.com/.../Sumatra_Coffee_large.png",
            "medium": "https://cdn.shopify.com/.../Sumatra_Coffee__medium.png",
            "original": "https://cdn.shopify.com/.../Sumatra_Coffee_.png",
            "small": "https://cdn.shopify.com/.../Sumatra_Coffee__small.png"
          },
          "original_price": "0.00",
          "price": "0.00",
          "product_title": "Sumatra Coffee Dark",
          "properties": [
            {
              "name": "grind",
              "value": "drip"
            }
          ],
          "quantity": 4,
          "shopify_product_id": 1255183683,
          "shopify_variant_id": 32720763846,
          "sku": "MILK-1",
          "subscription_id": 26375706,
          "title": "Sumatra Coffee Dark",
          "variant_title": "Milk - a / b"
        }
      ],
      "note": "shopifyCartToken_littledata:45af6dbe140d8dc1a9b7821ae256cfff GAClientId:1215763073.1492751771 -  next order #3   - Subscription Recurring Order",
      "note_attributes": null,
      "payment_processor": "stripe",
      "processed_at": null,
      "scheduled_at": "2022-11-16T00:00:00",
      "shipped_date": null,
      "shipping_address": {
        "address1": "1933 Manning",
        "address2": "204",
        "city": "los angeles",
        "company": "bootstrap",
        "country": "United States",
        "first_name": "mike",
        "last_name": "flynn",
        "phone": "3103103101",
        "province": "California",
        "zip": "90025"
      },
      "shipping_date": "2022-11-16T00:00:00",
      "shipping_lines": [],
      "shopify_cart_token": "45af6dbe140d8dc1a9b7821ae256cfff",
      "shopify_customer_id": "6454896021",
      "shopify_id": null,
      "shopify_order_id": null,
      "shopify_order_number": null,
      "status": "QUEUED",
      "subtotal_price": 0,
      "tags": "Prepaid, Subscription, Subscription Recurring Order",
      "tax_lines": [
        {
          "price": "0.950",
          "rate": 0.0725,
          "title": "CA State Tax"
        },
        {
          "price": "0.335",
          "rate": 0.0225,
          "title": "Los Angeles  County Tax"
        }
      ],
      "total_discounts": 0,
      "total_duties": 0,
      "total_line_items_price": 0,
      "total_price": 0,
      "total_refunds": null,
      "total_tax": 0,
      "total_weight": 0,
      "transaction_id": "ch_1DUDEtJ2zqHvZRd1EQHjapRD",
      "type": "RECURRING",
      "updated_at": "2018-11-09T10:07:52"
    }
  ]
}

Count orders

Retrieve a count of all orders.


## HTTP request examples

GET /orders/count
GET /orders/count
GET /orders/count?address_id=123123
GET /orders/count?charge_id=123123
GET /orders/count?created_at_min=2015-01-01&created_at_max=2019-02-02
GET /orders/count?customer_id=123123
GET /orders/count?scheduled_at_min=2016-01-01&scheduled_at_max=2019-02-02
GET /orders/count?shopify_customer_id=123123123
GET /orders/count?subscription_id=123123
GET /orders/count?status=queued

Scopes: read_orders
Query Parameters
  • address_id
    string

    Filter orders by address.
    GET /orders/?address_id=123 will return all orders for the given address_id

  • charge_id
    string

    Filter orders by charge.
    GET /orders/?charge_id=123 will return all orders for the given charge_id

  • created_at_max
    string

    Show orders created before the given date.

  • created_at_min
    string

    Show orders created after the given date.

  • customer_id
    string

    Filter orders by customer.
    GET /orders/?customer_id=123 will return all orders for the given customer_id

  • scheduled_at_max
    string

    Show orders scheduled before the given date.

  • scheduled_at_min
    string

    Show orders scheduled after the given date.

  • shopify_customer_id
    string

    Return the count of orders by shopify_customer_id.

  • status
    string

    Filter orders by status. Available status: “SUCCESS”, “QUEUED”, “ERROR”, “REFUNDED”, “SKIPPED”.

  • subscription_id
    string

    Filter orders by subscriptions.
    GET /orders/?subscription_id=123 will return all orders for the given subscription_id

  • updated_at_max
    string

    Show orders updated before the given date.

  • updated_at_min
    string

    Show orders updated after the given date.

Responses
  • 200

    successful response

GET
/orders/count
curl 'https://api.rechargeapps.com/orders/count' \ 
 -H 'X-Recharge-Access-Token: your_api_token'
Response
{
  "count": 38667
}

Change an order date

Modify the shipping date of the order.

Scopes: write_orders
Body Parameters
  • scheduled_at
    datetime
    * Required

    New shipping date in ISO 8601 format.

Responses
  • 200

    Success

POST
/orders/{id}/change_date
curl 'https://api.rechargeapps.com/orders/7271806/change_date' \ 
 -H 'Content-Type: application/json' \ 
 -H 'X-Recharge-Access-Token: your_api_token' \ 
 -d '{"scheduled_at": "2018-07-01T00:00:00"}'
Response
{
  "order": {
    "id": 70071255,
    "address_id": 4029306,
    "address_is_active": 1,
    "billing_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "charge_id": 97376832,
    "charge_status": "SUCCESS",
    "currency": "USD",
    "customer": {
      "accepts_marketing": true,
      "email": "examlpe@email.com",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": null,
      "send_email_welcome": false,
      "verified_email": true
    },
    "created_at": "2018-11-08T08:08:09",
    "customer_id": 4203912,
    "discount_codes": [],
    "email": "examlpe@email.com",
    "first_name": "mike",
    "hash": "42039120ee0e6cfa5c97805",
    "is_prepaid": 1,
    "last_name": "flynn",
    "line_items": [
      {
        "grams": 0,
        "images": {
          "large": "https://cdn.shopify.com/.../Sumatra_Coffee_large.png",
          "medium": "https://cdn.shopify.com/.../Sumatra_Coffee__medium.png",
          "original": "https://cdn.shopify.com/.../Sumatra_Coffee_.png",
          "small": "https://cdn.shopify.com/.../Sumatra_Coffee__small.png"
        },
        "original_price": "0.00",
        "price": "0.00",
        "product_title": "Sumatra Coffee Dark",
        "properties": [
          {
            "name": "grind",
            "value": "drip"
          }
        ],
        "quantity": 4,
        "shopify_product_id": 1255183683,
        "shopify_variant_id": 3844924611,
        "sku": "MILK-1",
        "subscription_id": 26375706,
        "title": "Sumatra Coffee Dark",
        "variant_title": "Milk - a / b"
      }
    ],
    "note": "next order #3",
    "note_attributes": null,
    "payment_processor": "stripe",
    "processed_at": null,
    "scheduled_at": "2018-07-01T00:00:00",
    "shipped_date": null,
    "shipping_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "shipping_date": "2022-11-16T00:00:00",
    "shipping_lines": [],
    "shopify_cart_token": "45af6dbe140d8dc1a9b7821ae256cfff",
    "shopify_customer_id": "6454896021",
    "shopify_id": null,
    "shopify_order_id": null,
    "shopify_order_number": null,
    "status": "QUEUED",
    "subtotal_price": 0,
    "tags": "Prepaid, Subscription, Subscription Recurring Order",
    "tax_lines": [
      {
        "price": "0.950",
        "rate": 0.0725,
        "title": "CA State Tax"
      },
      {
        "price": "0.335",
        "rate": 0.0225,
        "title": "Los Angeles  County Tax"
      }
    ],
    "total_discounts": 0,
    "total_duties": 0,
    "total_line_items_price": 0,
    "total_price": 0,
    "total_refunds": null,
    "total_tax": 0,
    "total_weight": 0,
    "transaction_id": "ch_1DUDEtJ2zqHvZRd1EQHjapRD",
    "type": "RECURRING",
    "updated_at": "2018-06-09T10:07:52"
  }
}

Change an order variant

Modify the shopify product variant of the order.

Scopes: write_orders
Body Parameters
  • new_shopify_variant_id
    integer
    * Required

    Unique numeric identifier of new shopify product variant.

  • shopify_variant_id
    string
    * Required

    Unique numeric identifier of existing shopify product variant.

Responses
  • 200

    Success

PUT
/orders/{id}/update_shopify_variant/{remote_variant_id}
curl 'https://api.rechargeapps.com/orders/1234/update_shopify_variant/454545' \ 
 -H 'Content-Type: application/json' \ 
 -H 'X-Recharge-Access-Token: your_api_token' \ 
 -d '{"new_shopify_variant_id": "32720763846"}'
Response
{
  "order": {
    "id": 70071255,
    "address_id": 4029306,
    "address_is_active": 1,
    "billing_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "charge_id": 97376832,
    "charge_status": "SUCCESS",
    "currency": "USD",
    "customer": {
      "accepts_marketing": true,
      "email": "examlpe@email.com",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": null,
      "send_email_welcome": false,
      "verified_email": true
    },
    "created_at": "2018-11-08T08:08:09",
    "customer_id": 4203912,
    "discount_codes": [],
    "email": "examlpe@email.com",
    "first_name": "mike",
    "hash": "42039120ee0e6cfa5c97805",
    "is_prepaid": 1,
    "last_name": "flynn",
    "line_items": [
      {
        "grams": 0,
        "images": {
          "large": "https://cdn.shopify.com/.../Sumatra_Coffee_large.png",
          "medium": "https://cdn.shopify.com/.../Sumatra_Coffee__medium.png",
          "original": "https://cdn.shopify.com/.../Sumatra_Coffee_.png",
          "small": "https://cdn.shopify.com/.../Sumatra_Coffee__small.png"
        },
        "original_price": "0.00",
        "price": "0.00",
        "product_title": "Sumatra Coffee Dark",
        "properties": [
          {
            "name": "grind",
            "value": "drip"
          }
        ],
        "quantity": 4,
        "shopify_product_id": 1255183683,
        "shopify_variant_id": 3844924611,
        "sku": "MILK-1",
        "subscription_id": 26375706,
        "title": "Sumatra Coffee Dark",
        "variant_title": "Milk - a / b"
      }
    ],
    "note": "next order #3",
    "note_attributes": null,
    "payment_processor": "stripe",
    "processed_at": null,
    "scheduled_at": "2018-07-01T00:00:00",
    "shipped_date": null,
    "shipping_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "shipping_date": "2022-11-16T00:00:00",
    "shipping_lines": [],
    "shopify_cart_token": "45af6dbe140d8dc1a9b7821ae256cfff",
    "shopify_customer_id": "6454896021",
    "shopify_id": null,
    "shopify_order_id": null,
    "shopify_order_number": null,
    "status": "QUEUED",
    "subtotal_price": 0,
    "tags": "Prepaid, Subscription, Subscription Recurring Order",
    "tax_lines": [
      {
        "price": "0.950",
        "rate": 0.0725,
        "title": "CA State Tax"
      },
      {
        "price": "0.335",
        "rate": 0.0225,
        "title": "Los Angeles  County Tax"
      }
    ],
    "total_discounts": 0,
    "total_duties": 0,
    "total_line_items_price": 0,
    "total_price": 0,
    "total_refunds": null,
    "total_tax": 0,
    "total_weight": 0,
    "transaction_id": "ch_1DUDEtJ2zqHvZRd1EQHjapRD",
    "type": "RECURRING",
    "updated_at": "2018-06-09T10:07:52"
  }
}

Clone an order

You may add additional Orders onto a success Charge if it has existing prepaid Orders by cloning an existing Order.

Scopes: write_orders
Body Parameters
  • scheduled_at
    datetime
    * Required

    Date in future when this order will be sent.

Responses
  • 200

    Success

POST
/orders/clone_order_on_success_charge/{order_id}/charge/{charge_id}
curl 'https://api.rechargeapps.com/orders/clone_order_on_success_charge/70071255/charge/100714428' \ 
 -H 'Content-Type: application/json' \ 
 -H 'X-Recharge-Access-Token: your_api_token' \ 
 -d '{"scheduled_at": "2022-11-16"}'
Response
{
  "order": {
    "id": 70071255,
    "address_id": 4029306,
    "address_is_active": 1,
    "billing_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "charge_id": 97376832,
    "charge_status": "SUCCESS",
    "currency": "USD",
    "customer": {
      "accepts_marketing": true,
      "email": "examlpe@email.com",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": null,
      "send_email_welcome": false,
      "verified_email": true
    },
    "created_at": "2018-11-08T08:08:09",
    "customer_id": 4203912,
    "discount_codes": [],
    "email": "examlpe@email.com",
    "first_name": "mike",
    "hash": "42039120ee0e6cfa5c97805",
    "is_prepaid": 1,
    "last_name": "flynn",
    "line_items": [
      {
        "grams": 0,
        "images": {
          "large": "https://cdn.shopify.com/.../Sumatra_Coffee_large.png",
          "medium": "https://cdn.shopify.com/.../Sumatra_Coffee__medium.png",
          "original": "https://cdn.shopify.com/.../Sumatra_Coffee_.png",
          "small": "https://cdn.shopify.com/.../Sumatra_Coffee__small.png"
        },
        "original_price": "0.00",
        "price": "0.00",
        "product_title": "Sumatra Coffee Dark",
        "properties": [
          {
            "name": "grind",
            "value": "drip"
          }
        ],
        "quantity": 4,
        "shopify_product_id": 1255183683,
        "shopify_variant_id": 3844924611,
        "sku": "MILK-1",
        "subscription_id": 26375706,
        "title": "Sumatra Coffee Dark",
        "variant_title": "Milk - a / b"
      }
    ],
    "note": "next order #3",
    "note_attributes": null,
    "payment_processor": "stripe",
    "processed_at": null,
    "scheduled_at": "2018-07-01T00:00:00",
    "shipped_date": null,
    "shipping_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "shipping_date": "2022-11-16T00:00:00",
    "shipping_lines": [],
    "shopify_cart_token": "45af6dbe140d8dc1a9b7821ae256cfff",
    "shopify_customer_id": "6454896021",
    "shopify_id": null,
    "shopify_order_id": null,
    "shopify_order_number": null,
    "status": "QUEUED",
    "subtotal_price": 0,
    "tags": "Prepaid, Subscription, Subscription Recurring Order",
    "tax_lines": [
      {
        "price": "0.950",
        "rate": 0.0725,
        "title": "CA State Tax"
      },
      {
        "price": "0.335",
        "rate": 0.0225,
        "title": "Los Angeles  County Tax"
      }
    ],
    "total_discounts": 0,
    "total_duties": 0,
    "total_line_items_price": 0,
    "total_price": 0,
    "total_refunds": null,
    "total_tax": 0,
    "total_weight": 0,
    "transaction_id": "ch_1DUDEtJ2zqHvZRd1EQHjapRD",
    "type": "RECURRING",
    "updated_at": "2018-06-09T10:07:52"
  }
}

Delay an order

Delay a prepaid Order by one interval

The id must be for the next queued Order for a prepaid Subscription. The Order will be delayed by one interval, and all subsequent Orders and Charges will be shifted by the same amount.

Scopes: write_orders
Responses
  • 200

    successful response

POST
/orders/{id}/delay
curl -X POST 'https://api.rechargeapps.com/orders/70071255/delay' \ 
 -H 'Content-Type: application/json' \ 
 -H 'X-Recharge-Access-Token: your_api_token'
Response
{
  "order": {
    "id": 70071255,
    "address_id": 4029306,
    "address_is_active": 1,
    "billing_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "charge_id": 97376832,
    "charge_status": "QUEUED",
    "created_at": "2022-02-04T18:19:52",
    "currency": "USD",
    "customer": {
      "accepts_marketing": true,
      "email": "examlpe@email.com",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": null,
      "send_email_welcome": false,
      "verified_email": true
    },
    "customer_id": 4203912,
    "discount_codes": [],
    "email": "examlpe@email.com",
    "first_name": "mike",
    "hash": "42039120ee0e6cfa5c97805",
    "is_prepaid": 1,
    "last_name": "flynn",
    "line_items": [
      {
        "grams": 0,
        "images": {
          "large": "https://cdn.shopify.com/.../Sumatra_Coffee_large.png",
          "medium": "https://cdn.shopify.com/.../Sumatra_Coffee__medium.png",
          "original": "https://cdn.shopify.com/.../Sumatra_Coffee_.png",
          "small": "https://cdn.shopify.com/.../Sumatra_Coffee__small.png"
        },
        "original_price": "0.00",
        "price": "0.00",
        "product_title": "Sumatra Coffee Dark",
        "properties": [
          {
            "name": "grind",
            "value": "drip"
          }
        ],
        "quantity": 4,
        "shopify_product_id": 1255183683,
        "shopify_variant_id": 3844924611,
        "sku": "MILK-1",
        "subscription_id": 26375706,
        "title": "Sumatra Coffee Dark",
        "variant_title": "Milk - a / b"
      }
    ],
    "note": "next order #3",
    "note_attributes": null,
    "payment_processor": "stripe",
    "processed_at": null,
    "scheduled_at": "2023-03-07T00:00:00",
    "shipped_date": null,
    "shipping_address": {
      "address1": "1933 Manning",
      "address2": "204",
      "city": "los angeles",
      "company": "bootstrap",
      "country": "United States",
      "first_name": "mike",
      "last_name": "flynn",
      "phone": "3103103101",
      "province": "California",
      "zip": "90025"
    },
    "shipping_date": "2023-03-07T00:00:00",
    "shipping_lines": [],
    "shopify_cart_token": "45af6dbe140d8dc1a9b7821ae256cfff",
    "shopify_customer_id": "6454896021",
    "shopify_id": null,
    "shopify_order_id": null,
    "shopify_order_number": null,
    "status": "QUEUED",
    "subtotal_price": 0,
    "tags": "Prepaid, Subscription, Subscription Recurring Order",
    "tax_lines": [
      {
        "price": "0.950",
        "rate": 0.0725,
        "title": "CA State Tax"
      },
      {
        "price": "0.335",
        "rate": 0.0225,
        "title": "Los Angeles  County Tax"
      }
    ],
    "total_discounts": 0,
    "total_duties": 0,
    "total_line_items_price": 0,
    "total_price": 0,
    "total_refunds": null,
    "total_tax": 0,
    "total_weight": 0,
    "transaction_id": "ch_1DUDEtJ2zqHvZRd1EQHjapRD",
    "type": "RECURRING",
    "updated_at": "2023-01-17T11:36:08"
  }
}

Products

The subscription settings associated to a remote catalog product

Endpoints
POST
/products
GET
/products/{id}
PUT
/products/{id}
DELETE
/products/{id}
GET
/products
GET
/products/count

Shop

The shop endpoint includes basic info about your Recharge store setup.

Endpoints
GET
/shop
GET
/shop/shipping_countries

Subscriptions

Subscriptions are individual items a customer receives on a recurring basis.

A subscription is a product added to an address.

If store owner wants to sell multiple products as one subscription on 1 address it can be done by creating a product in Shopify that consists of multiple products e.g. 3 types of vegetables in the box, set of different shirts, etc. This multiple products appear on the store as 1 product, therefore it can be sold in a single subscription to 1 or more addresses.

Endpoints
POST
/subscriptions
GET
/subscriptions/{id}
PUT
/subscriptions/{id}
DELETE
/subscriptions/{id}
GET
/subscriptions
GET
/subscriptions/count
POST
/subscriptions/{id}/set_next_charge_date
POST
/subscriptions/{id}/change_address
POST
/subscriptions/{id}/cancel
POST
/subscriptions/{id}/activate
POST
/addresses/{id}/subscriptions-bulk
PUT
/addresses/{id}/subscriptions-bulk
DELETE
/addresses/{id}/subscriptions-bulk

Webhook endpoints

Webhooks are a mechanism for reacting to specific events that are triggered in the Recharge system.
For example, a checkout completion, a customer activation or subscription cancellation. Webhooks will deliver you the data of the specific event in real-time. This data can be used to custom code logic behind automated subscription management, dashboards creation, discounts applying…


Retries / Idempotency
Due to webhook retries, it’s possible that your application receives the same webhook more than once. Ensure idempotency of the webhook call by detecting such duplicates within your application.


When a webhook is triggered, the payload will be identical to the payload you would receive from another API endpoint.

For example, a webhook on subscription/created event will be identical to the payload for retrieving a subscription by ID from the Recharge API.

There are a lot of things that can be done via Webhooks: It can be used to collect all kinds of data from our API and then create custom a Dashboard to show how much and when your customers are buying in real time, or use all this data to do Analytics of some kind in order to create a better customer experience. Webhooks can be used as a “Trigger” on your backend to update subscription products.

If you have some kind of a Subscription where you want to change the Product that the customer gets every month, you can do it by waiting for an order/created webhook on your backend, and when it fires you can make an API call to change the Product of that subscription or the next shipping date, etc.


## Respond to a webhook

Your webhook acknowledges that it received data by sending a 200 OK response. Any response outside of the 200 range will let Recharge know that you didn’t receive your webhook. Recharge has implemented a 5 second time-out period. We wait 5 seconds, if our system doesn’t get a response in that period we consider that request as failed. Our system will try 20 times to send the same webhook over the next 2 days, if the request fails every time our system will delete this webhook. At this moment our system is logging those deleted webhooks.

Endpoints
POST
/webhooks
GET
/webhooks/{id}
PUT
/webhooks/{id}
DELETE
/webhooks/{id}
GET
/webhooks
POST
/webhooks/{id}/test

Webhooks explained

Here you will find what specific action triggers a given webhook.


Address webhooks

To use these webhooks your API Token must have read permissions for Customers enabled ( read_customer ).


Topic Explanation
address/created This will trigger when you create an address via API, or when you go through the checkout with a particular address for the first time with the same customer.
address/updated This will trigger when you update an address via API, or when you update the address via UI. It will also trigger whenever a subscription has been activated or cancelled.

Charge webhooks

To use these webhooks your API Token must have read permissions for Orders enabled ( read_orders ).


Topic Explanation
charge/created This will trigger when your customers checkout successfully (only on the UI checkout success).
charge/failed This will trigger every time we try to process a charge and it fails due to various reasons (insufficient funds, invalid CC info, expired CC, etc.) on both API and UI.
charge/max_retries_reached This will trigger after we attempt to process a charge 8 times, and it failed every time due to various CC issues. This can be triggered on both UI (manually retry a charge 8 times and fail) and API.
charge/paid This will trigger when a charge is successfully processed, both manually via UI and automatic recurring charge. This will not trigger on the checkout itself.
charge/refunded This will trigger when a charge is successfully refunded, either partially or in full. It will fire if a charge has been refunded both manually via UI and through an API request.
charge/upcoming This will trigger X days before the upcoming charge is scheduled. The default is 3 days but your store specific setting can be verified on the Notification Settings page in the description of the Upcoming charge customer notification.
charge/updated This will trigger when applying a discount, a change to charge that recalculates shipping rates as well as if next_charge_date is updated on charge endpoint charges/<charge_id>/change_next_charge_date.
charge/deleted This will trigger when a subscription is cancelled and upcoming charges are deleted.

Checkout webhooks

To use these webhooks your API Token must have read permissions for Orders enabled ( read-orders ).


Topic Explanation
checkout/created This will trigger when a checkout is successfully created.
checkout/completed Will be deprecated.
checkout/processed This will trigger when a checkout is successfully processed.
checkout/updated This will trigger when a checkout is successfully updated.

Customer webhooks

To use these webhooks your API Token must have read permissions for Customers enabled ( read_customers ).


Topic Explanation
customer/activated This will trigger when you activate* a customer
* activating means that you have added a subscription to a customer who didn’t have an active subscription previously.
customer/created This will trigger when you create a customer via API or go through the checkout with a particular email address for a first time customer.
customer/deactivated This will trigger when the last subscription a customer had expires, so he no longer has ANY active subscriptions (which means there are no QUEUED charges/orders for this customer).
customer/payment_method_updated This will trigger only* when you update the payment_token from the UI
* We are working on triggering this when you do the update from the API as well.
customer/updated This will trigger when you update a customer via both API and UI.
customer/deleted This will trigger when you delete a customer via both API and UI.

Onetime webhooks

To use these webhooks your API Token must have read permissions for Subscriptions enabled ( read_subscriptions ).


Topic Explanation
onetime/created This will trigger when you create a one time product via API.
onetime/deleted This will trigger when you delete a one time product via API.
onetime/updated This will trigger when you update a one time product via API.

Order webhooks

To use these webhooks your API Token must have read permissions for Orders enabled ( read_orders ).


Topic Explanation
order/created This will trigger when an order is created (when a charge is successfully processed)
* In case of prepaid Orders there will be multiple order/created webhooks fired, one for every queued order created at once.
order/deleted This will trigger when an order is deleted.
order/processed This will trigger when the order is processed (when an order goes from status queued to status success). This will not trigger on checkout.
order/upcoming This will trigger X days before a QUEUED (prepaid) order is scheduled to be processed. The default is 3 days.
order/updated This will trigger when an order is updated.

Plan webhooks

To use these webhooks your API Token must have read permissions for Products enabled ( read_products ).


Topic Explanation
plan/created This will trigger when a plan is created by one of the following methods: via API, via Merchant portal or when using the 2021-01 Products endpoint.
plan/deleted This will trigger when a plan is deleted by one of the following methods: via API, via Merchant portal or when using the 2021-01 Products endpoint.
plan/updated This will trigger when a plan is updated by one of the following methods: via API, via Merchant portal or when using the 2021-01 Products endpoint…

Subscription webhooks

To use these webhooks your API Token must have read permissions for Subscriptions enabled ( read_subscriptions ).


Topic Explanation
subscription/activated This will trigger when you activate a subscription via API or UI.
subscription/cancelled This will trigger when you cancel a subscription via API or UI. An involuntary subscription cancelled due to max retries reached will only trigger the charge/max_retries_reached webhook and not the subscription/cancelled webhook.
subscription/created This will trigger when you create a subscription via API or when you go through the checkout on UI.
subscription/deleted This will trigger when you delete a subscription via API or UI.
subscription/skipped This will trigger when you skip a subscription within a charge, meaning that you only skip a particular subscription (the subscription_id you send in the body) in that charge if there are multiple subscriptions related to that charge.
subscription/unskipped This will trigger when you unskip a subscription within a charge, meaning you only unskip a particular subscription (the subscription_id you send in the body) in that charge if there are multiple subscriptions related to that charge.
subscription/updated This will trigger when you update a subscription via API (PUT method) or when you update the subscription via UI. This will also trigger when you update next charge date on Customer Portal, or when you change it using subscription endpoint subscriptions/ <subscription_id>set_next_charge_date.
subscription/swapped This will trigger when you swap a subscription product for a given address to a different product or product variation API or UI.
subscription/paused This will trigger when a customer pauses a subscription from within the customer portal.

Other webhooks

To use these webhooks your API Token must have read permissions for Store enabled ( read_store ).


Topic Explanation
app/uninstalled This will trigger when you uninstall OAuth app on your store.
recharge/uninstalled This will trigger when Recharge is uninstalled.
store/updated This will trigger when and update has been made to the store.

Webhook validation

Webhooks created through the API can be verified by calculating a digital signature. Each Webhook request includes an X-Recharge-Hmac-Sha256 header which is generated using the API Client Secret, along with the data sent in the request.

API Client Secret is not the same as your API token and it can be found at:
Recharge Dashboard—>Integrations—>API Tokens—>Click on your token
Edit API Token page will appear and there you will find API Client Secret

The request_body must be in JSON string format. Validation will fail even if one space is lost in process of JSON string generation.

Then use code similar to the example by adapting it to the programming language that you are using for your project.

Related guides: Example code for validating webhooks

Example Request:

Async batch endpoints

The Async batches API can be used for processing large volumes of operations asynchronously, in order to reduce aggregate processing time and network traffic when interacting with many unique objects. For example, a user can leverage async_batches to create 1000 discounts with only 3 API requests.

As shown in the diagram below, the necessary steps to create and process a batch are:

1. Create an async_batch with the desired batch_type

2. Add tasks (individual operations) to your batch. You can add up to 1,000 tasks with each request, up to 10,000 tasks per batch.

3. Submit the batch for processing. Until a batch is submitted for processing, no tasks are attempted.

4. You may retrieve the batch to view progress details while it processes, or register for the async_batch/processed webhook to receive immediate notification of batch completion.

5. Page through the tasks in the batch to view results of each completed or failed task.

Related guides: Examples of Async batches

Endpoints
POST
/async_batches
GET
/async_batches/{id}
GET
/async_batches
POST
/async_batches/{batch_id}/process

Async batch tasks

Most commonly, the response from listing tasks on an async_batch id will be identical to the body of a singular request to standard Recharge API endpoints. However, in some instances there are variations from the standard list task response body. See below for examples corresponding to each batch_type.

Related guides: Examples of async batches

Endpoints
POST
/async_batches/{batch_id}/tasks
GET
/async_batches/{batch_id}/tasks

Token information

This resource allows a caller to inspect basic information regarding the token in use. It will only return a single object related to the calling token ( ie - a call with api_token.id=1 will only return information regarding api_token.id=1.

Endpoints
GET
/token_information