API: Customers

Customers in Recharge are individual accounts that can each have their own stored payment methods, recurring and one-time charges associated with them.

When accessing a customer, Recharge will return all associated Payment Methods and Charges.

Attributes for Payment Methods and Charges are explained in detail on their respective pages.

 

Customer Attributes

Parameter Description
id The unique identifier for the customer.
refID User-specified reference ID for the customer used by your company.
firstName Customer first name.
lastName Customer last name.
email Customer email.
company Customer company or organization name.
phone Customer phone number. Formatted (xxx) xxx-xxxx.
billingAddress1 Customer billing address.
billingAddress2 Customer billing address.
billingCity Customer billing city.
billingState Customer billing state.
billingZIP Customer billing ZIP code. (5 Digits)
shippingAddress1 Customer shipping address.
shippingAddress2 Customer shipping address.
shippingCity Customer shipping city.
shippingState Customer shipping state.
shippingZIP Customer shipping ZIP code. (5 Digits)
emailOption Defines whether or not the system should send email receipts to the customer. 1 for yes, 0 for no.
signupDate Date the customer was created. Formatted like "MM/DD/YYYY HH:MM AM/PM"

 

List Customers

GET /customers

Lists all your active customers.

 

Get Customer Details

GET /customers/<customer_id>

Returns the customer's information, along with all associated payment methods and charges.

Response

<customer id="cu4ea0dbd111ce9">
	<id>cu4ea0dbd111ce9</id> 
	<refID>123</refID> 
	<firstName>Test</firstName> 
	<lastName>Jones</lastName> 
	<email>test.jones@email.com</email> 
	<company>ABC Company</company> 
	<phone>(888) 777-6252</phone> 
	<billingAddress1>123 Any Street</billingAddress1> 
	<billingAddress2>Ste 3</billingAddress2> 
	<billingCity>Los Angeles</billingCity> 
	<billingState>CA</billingState> 
	<billingZIP>90210</billingZIP> 
	<shippingAddress1></shippingAddress1> 
	<shippingAddress2></shippingAddress2> 
	<shippingCity></shippingCity> 
	<shippingState></shippingState> 
	<shippingZIP></shippingZIP> 
	<emailOption>1</emailOption> 
	<signupDate>02/19/2019 9:40 AM</signupDate> 
	<payMethods>
		<payMethod id="pm4ea0e1028632e">
			<id>pm4ea0e1028632e</id> 
			<alias>aKCr4R7bEH</alias> 
			<cardType>Visa</cardType> 
			<last4>1111</last4> 
			<expDate>1212</expDate> 
			<nameOnCard>Test Jones</nameOnCard> 
		</payMethod>
	</payMethods>
	<charges>
		<charge id="ch4ea0e20461c82">
			<id>ch4ea0e20461c82</id> 
			<product>pr4e8ade1abbf67</product> 
			<payMethod>pm4e8ae6d5b9e23</payMethod> 
			<billingStartDate>10/04/2011 12:00 AM</billingStartDate> 
			<billingEndDate></billingEndDate> 
			<billingEndAmount></billingEndAmount> 
			<price>1.00</price> 
			<intervalValue>1</intervalValue> 
			<intervalUnit>m</intervalUnit> 
			<nextChargeDate>11/04/2011 12:00 AM</nextChargeDate> 
			<totalRevenue>0.00</totalRevenue> 
			<pubID>f376f78d8acedb1b4dc858919f63f3b8cd84311a</pubID> 
		</charge>
	</charges>
</customer>

 

Create Customer

POST /customers

Creates a new customer in Recharge and returns information about it.

Request

$fields['refID'] = "123"; 
$fields['firstName'] = "Test"; 
$fields['lastName'] = "Jones"; 
$fields['email'] = "test.jones@email.com"; 
$fields['company'] = "ABC Company"; 
$fields['phone'] = "(888) 777-6252"; 
$fields['billingAddress1'] = "123 Any Street"; 
$fields['billingAddress2'] = "Ste 3"; 
$fields['billingCity'] = "Los Angeles"; 
$fields['billingState'] = "CA"; 
$fields['billingZIP'] = "90210"; 
$fields['signupDate'] = "02/19/2019 9:40 AM";

Response

<customer id="cu4ea0dbd111ce9">
	<id>cu4ea0dbd111ce9</id> 
	<refID>123</refID> 
	<firstName>Test</firstName> 
	<lastName>Jones</lastName> 
	<email>test.jones@email.com</email> 
	<company>ABC Company</company> 
	<phone>(888) 777-6252</phone> 
	<billingAddress1>123 Any Street</billingAddress1> 
	<billingAddress2>Ste 3</billingAddress2> 
	<billingCity>Los Angeles</billingCity> 
	<billingState>CA</billingState> 
	<billingZIP>90210</billingZIP> 
	<shippingAddress1></shippingAddress1> 
	<shippingAddress2></shippingAddress2> 
	<shippingCity></shippingCity> 
	<shippingState></shippingState> 
	<shippingZIP></shippingZIP> 
	<emailOption>0</emailOption> 
	<signupDate>02/19/2019 9:40 AM</signupDate> 
	<payMethods>
		...
	</payMethods>
	<charges>
		...
	</charges>
</customer>

 

Edit Customer

POST /customers/<customer_id>

Edits a customer and returns the current information about it.

Request

$fields['email'] = "testjones@gmail.com"; 
$fields['emailOption'] = "1"; 

Response

<customer id="cu4ea0dbd111ce9">
	<id>cu4ea0dbd111ce9</id> 
	<refID>123</refID> 
	<firstName>Test</firstName> 
	<lastName>Jones</lastName> 
	<email>testjones@gmail.com</email> 
	<company>ABC Company</company> 
	<phone>(888) 777-6252</phone> 
	<billingAddress1>123 Any Street</billingAddress1> 
	<billingAddress2>Ste 3</billingAddress2> 
	<billingCity>Los Angeles</billingCity> 
	<billingState>CA</billingState> 
	<billingZIP>90210</billingZIP> 
	<shippingAddress1></shippingAddress1> 
	<shippingAddress2></shippingAddress2> 
	<shippingCity></shippingCity> 
	<shippingState></shippingState> 
	<shippingZIP></shippingZIP> 
	<emailOption>1</emailOption> 
	<signupDate>02/19/2019 9:40 AM</signupDate> 
	<payMethods>
		...
	</payMethods>
	<charges>
		...
	</charges>
</customer>

 

Delete Customer

DELETE /customers/<customer_id>

Deletes the customer from Recharge. Also deletes all associated payment methods, charges, and cancels all future transactions.