API Introduction

The recharge API lets you integrate your own application easily with our service.

With the API, you can view/add/edit/delete products, customers, payment methods, charges and more all from within your custom application. You can also use the API to perform one-time credit card charges such as purchases, returns, and voids.

The API attempts to conform to the RESTful design principles. If you're not a web designer or programmer, or you get stuck, please call, email or twitter us for help!

 

Authentication

The recharge API uses basic HTTP authentication over SSL. Just send your API key as the HTTP username and you'll be authenticated. More details are covered in API Authentication.

 

URL

The URL for all API requests includes the API version and the resource you're working with:

https://www.rechargebilling.com/API/v2/[resource]

 

Resources

The full list of resources exposed via the API can be found in API Resources.

 

Response Data

Data is returned in XML format.

 

Request Data

The Recharge API accepts POST data when adding or editing a resource. This data should be sent via standard HTTP POST or Form-Encoded data.

 

Debugging

If something isn't working quite right, try simply submitting your request via command-line CURL, as shown in the example below.

We also like using PostBin. Post the data to your own PostBin URL instead of the Recharge API URL and it will be captured for you to examine exactly what's being sent from your application.

If all else fails, give us a call or send us an email. We can send you logs of exactly what we received on our end to help you troubleshoot.

 

Examples

Here is an example of how to execute an API request to list all products:

Request:

curl -u <api_key> https://www.rechargebilling.com/API/v2/products

Response:

				<response>
	<result>
		<resultCode>000</resultCode>
		<resultDescription>Product Lookup Successful</resultDescription>
	</result>
	<seller>
		<name>API Test</name>
		<phone>(888) 777-6252</phone>
		<email>apitest@rechargebilling.com</email>
		<first>API</first>
		<last>Manager</last>
	</seller>
	<products>
		<product id="pr4e9948ab5eccd">
			<id>pr4e9948ab5eccd</id>
			<name>$1/mo product with no setup fee</name>
			<setupfee>0.00</setupfee>
			<price>1.00</price>
			<intervalValue>1</intervalValue>
			<intervalUnit>m</intervalUnit>
		</product>
			<product id="pr4e8ade1abbf67">
			<id>pr4e8ade1abbf67</id>
			<name>$2/day product with $1 setup fee</name>
			<setupfee>1.00</setupfee>
			<price>2.00</price>
			<intervalValue>1</intervalValue>
			<intervalUnit>d</intervalUnit>
		</product>
	</products>
</response>