Take your store to the next level with Recharge's scalable subscriptions payments solution. With the Recharge API, you can fully customize how subscriptions operate. Recharge provides a RESTful API and event-driven webhooks that allow for complex integration with partners.
Webhooks in Recharge's API are a mechanism for reacting to specified events that are triggered in the system, such as checkout completion, customer activation, or subscription cancellations.
Overview of Recharge API offerings
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.
Breakdown of the Recharge API offerings:
- Admin REST API: An Administrative REST API that supports nearly every function of the Recharge Platform.
- Storefront API: A new way of accessing the Recharge API, with browser safe tokens and content. Many resources of the Recharge REST API can be accessed as a Storefront API when using JWT authentication. Securely access the Recharge REST API directly from your Shopify Theme, with no backend server or third party software required.
Use the Recharge API to create better reporting and analytics, fulfillment, loyalty programs, trigger-based emails, and more.
Optimize your daily activities by automating pricing updates, discount codes, and cancellation flows.
- Develop a product page and custom checkout experience.
- Automate how you communicate with your customers post-checkout.
- Create a custom cancellation flow to reduce churn.
Rebuild your entire customer portal from the ground up. Design and customize how your customers manage their subscriptions and add new functionality specific to your industry.
Access API tokens
Access tokens are used in token-based authentication to allow an application to access an API. The application receives an access token after a user successfully authenticates and authorizes access, then passes the access token as a credential when it calls the target API. The passed token informs the API that the bearer of the token has been authorized to access the API and perform specific actions specified by the scope that was granted during authorization. Recharge requires an API key for requests to the server. Recharge only accepts requests over HTTPS.
View and create API tokens directly in Recharge:
- Select Apps from the merchant portal.
- Click on API tokens.
Accept the Recharge API Terms of Service
The Recharge API Terms of Service (ToS) will display if this is your first time accessing the API tokens page. You must accept the Recharge API Terms of Service before you can create your first API token.
The Recharge API Terms of Service document governs your access to and use of Recharge's APIs. When you develop on the Recharge platform, you are agreeing to be bound by these terms.
Even if you have accepted the general Recharge Terms of Service, you will need to accept the API-specific ToS as it addresses terms specific using the Recharge API. Terms of Service are a standard industry practice that provides and requires consent on API-specific incidents not covered in the general ToS.
- Check all three terms within the API Terms of Service modal.
- Click Accept.
Create an API token
Once you have accessed the API Token Creation page, select Create an API Token to generate a new token for your store.
- Use the Details fields to set a name and contact email for the token.
- Select No access, Read access, or Read and Write access to set the scope permissions you'd like to grant the token. Access to certain endpoints (ie: payments) require permissions for that end point to be set.
- Click Save to create your token.
How to update or review the permission scope for API tokens
To confirm permissions for API tokens are enabled, or if you need to update an API token, check the following:
- Go to API tokens in the Recharge merchant portal.
- Click on the name of the token you would like to check. This opens the Edit API token page.
- Under Permission locate the setting you need to edit, then under Scope select from the dropdown menu either No access, Read access, or Read and Write access.
- Review the settings and click the Save button.
Enable API Token permissions for other users
By default, the store owner is the only one with the ability to create and manage API tokens.
The store owner can update the account permissions for an existing account, granting staff and developer accounts access to the API Tokens page.
Refer to Enabling Recharge user and account permissions for additional information.
Storefront API and JS SDK
Using the Storefront API, access the Recharge API using browser-safe tokens that can be called directly from the storefront without the use of middleware. Recharge will automatically scope permission to the specific customer, filter out information customers should not see, and inhibit customers from operations for admins.
With storefront access, the Recharge JS SDK was created to offer full coverage of common needs and uses the storefront API to improve the developer experience.
Benefits of using the JS SDK include:
- Reduce the complexity and cost of the build.
- No need to learn a new API and is fully typed, with auto-complete and debugging capabilities.
- Supports development in custom applications such as customer portal, custom bundles, and product pages.
- Pre-made functions such as authentication, data fetching, and streamlining store operations.
- Enables JS only integrations with the Shopify storefront such as Shopify Hydrogen apps, React apps, and other up and coming technology frameworks.
Visit the Recharge Storefront Client Developer Docs to view guides for using the Storefront API and JS SDK.
Create a Storefront API token
To create a Storefront API token:
- Select Apps from the merchant portal.
- Click API tokens, then select Create a Storefront API token.
- Enter Token nickname and Contact email, then click Save to generate token.
Recharge’s standard rate limit is 2 calls/second leak, 40 call bucket (1x1).
Merchants on the Pro plan have a default rate of 4 calls/second leak, 80 call bucket (2x2).
If you receive a 429 error, this indicates you have reached your API limit.
- Visit the Developer Docs to view guides and tutorials for using the Recharge API.
- Access the API Reference to view the Recharge API specification.
- Check out the Recharge Developer Hub for additional resources, including links to the Recharge Status Page and Changelog.
- Recharge operates a public channel on Slack for Recharge API-related questions. Reach out to the Recharge support team if you require access.
Didn’t find what you’re looking for?Contact us