java.lang.Object |
↳ |
com.wsl.modules.stripe.client.StripeCustomerClient |
Class Overview
Encapsulates Customer-related Stripe API calls.
Summary
Public Methods |
Customer
|
createCustomer(int accountBalance, String couponCode, String description, String email, Map<String, Object> metadata)
Create a Customer
|
Object
|
deleteCustomer(String id)
Delete a Customer
|
CustomerCollection
|
listAllCustomers(int limit, String startingAfter, String endingBefore)
List all Customers
|
Customer
|
retrieveCustomer(String id)
Retrieve a Customer
|
Customer
|
updateCustomer(String id, int accountBalance, String couponCode, String description, String email, Map<String, Object> metadata, String sourceToken)
Update a Customer.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
Public Constructors
public
StripeCustomerClient
()
Public Methods
public
Customer
createCustomer
(int accountBalance, String couponCode, String description, String email, Map<String, Object> metadata)
Parameters
accountBalance
| An integer amount in cents that is the starting account balance for your customer. A negative amount represents a credit that will be used before attempting any charges to the customer’s card; a positive amount will be added to the next invoice. |
couponCode
| If you provide a coupon code, the customer will have a discount applied on all recurring charges. Charges you create through the API will not have the discount. |
description
| An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard. |
email
| Customer’s email address. |
metadata
| A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format. |
public
Object
deleteCustomer
(String id)
Parameters
id
| The identifier of the customer to be deleted. |
Returns
- Returns an object with a deleted parameter on success. If the customer ID does not exist, this call throws an error.
public
CustomerCollection
listAllCustomers
(int limit, String startingAfter, String endingBefore)
Parameters
limit
| A limit on the number of records to fetch in a batch |
startingAfter
| A cursor (id) for use in pagination. |
endingBefore
| A cursor for use in pagination. ending_before is an object ID that defines your place in the list. |
Returns
- CustomerCollection of Customers found
public
Customer
retrieveCustomer
(String id)
Parameters
id
| The identifier of the customer to be retrieved. |
Returns
- Returns a customer object if a valid identifier was provided. When requesting the ID of a customer that has been deleted, a subset of the customer's information will be returned, including a "deleted" property, which will be true.
public
Customer
updateCustomer
(String id, int accountBalance, String couponCode, String description, String email, Map<String, Object> metadata, String sourceToken)
Update a Customer. Updates the specified customer by setting the values of the parameters passed. Any parameters not provided will be left unchanged. For example, if you pass the card parameter, that becomes the customer's active card to be used for all charges in the future. When you update a customer to a new valid card: for each of the customer's current subscriptions, if the subscription is in the past_due state, then the latest unpaid, unclosed invoice for the subscription will be retried (note that this retry will not count as an automatic retry, and will not affect the next regularly scheduled payment for the invoice). (Note also that no invoices pertaining to subscriptions in the unpaid state, or invoices pertaining to canceled subscriptions, will be retried as a result of updating the customer's card.) This request accepts mostly the same arguments as the customer creation call.
Parameters
id
| The id of the Customer to update |
accountBalance
| An integer amount in cents that is the starting account balance for your customer. A negative amount represents a credit that will be used before attempting any charges to the customer’s card; a positive amount will be added to the next invoice. |
couponCode
| If you provide a coupon code, the customer will have a discount applied on all recurring charges. Charges you create through the API will not have the discount. |
description
| An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard. |
email
| Customer’s email address. |
metadata
| A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format. |
sourceToken
| A token for a given source |