java.lang.Object |
↳ |
com.wsl.modules.stripe.client.StripePlanClient |
Class Overview
Encapsulates Plan-related Stripe API calls.
Summary
Public Methods |
Plan
|
createPlan(String id, int amount, String currency, String interval, int intervalCount, String planName, int trialPeriodDays, String statementDescriptor, Map<String, Object> metadata)
Create a Plan
|
Object
|
deletePlan(String id)
Delete a Plan
|
PlanCollection
|
listAllPlans(String createdTimestamp, TimeRange created, String endingBefore, int limit, String startingAfter)
List All Plans
|
Plan
|
retrievePlan(String id)
Retrieve a Plan
|
Plan
|
updatePlan(String id, String planName, String statementDescriptor, Map<String, Object> metadata)
Update a Plan
|
[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
StripePlanClient
()
Public Methods
public
Plan
createPlan
(String id, int amount, String currency, String interval, int intervalCount, String planName, int trialPeriodDays, String statementDescriptor, Map<String, Object> metadata)
Parameters
id
| Unique string of your choice that will be used to identify this plan when subscribing a customer. This could be an identifier like "gold" or a primary key from your own database. |
amount
| A positive integer in cents (or 0 for a free plan) representing how much to charge (on a recurring basis). |
currency
| 3-letter ISO code for currency. |
interval
| Specifies billing frequency. Either day, week, month or year. |
intervalCount
| The number of intervals between each subscription billing. For example, interval=month and interval_count=3 bills every 3 months. Maximum of one year interval allowed (1 year, 12 months, or 52 weeks). |
planName
| Name of the plan, to be displayed on invoices and in the web interface. |
trialPeriodDays
| Specifies a trial period in (an integer number of) days. If you include a trial period, the customer won't be billed for the first time until the trial period ends. If the customer cancels before the trial period is over, she'll never be billed at all. |
statementDescriptor
| An arbitrary string to be displayed on your customer's credit card statement. This may be up to22 characters. |
metadata
| A set of key/value pairs that you can attach to a plan object. It can be useful for storing additional information about the plan in a structured format. |
public
Object
deletePlan
(String id)
Parameters
id
| The id of the plan to delete |
Returns
- Object JSON containing success or failure
public
PlanCollection
listAllPlans
(String createdTimestamp, TimeRange created, String endingBefore, int limit, String startingAfter)
Parameters
createdTimestamp
| A filter on the list based on the object created field. The value can be a string with an integer Unix timestamp. |
created
| A filter on the list based on the object created field. The value can be a dictionary containing gt, gte, lt and/or lte values. You cannot supply a created value and this dictionary at the same time. |
endingBefore
| A cursor for use in pagination. ending_before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with obj_bar, your subsequent call can include ending_before=obj_bar in order to fetch the previous page of the list. |
limit
| A limit on the number of objects to be returned. Limit can range between 1 and 100 items. |
startingAfter
| A cursor for use in pagination. starting_after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include starting_after=obj_foo in order to fetch the next page of the list. |
Returns
- PlanCollection the plans that matched the criteria
public
Plan
retrievePlan
(String id)
Parameters
id
| The id of the plan to retrieve |
public
Plan
updatePlan
(String id, String planName, String statementDescriptor, Map<String, Object> metadata)
Parameters
id
| Of the plan to update |
planName
| Name of the plan, to be displayed on invoices and in the web interface. |
statementDescriptor
| An arbitrary string to be displayed on your customer's credit card statement. This may be up to22 characters. |
metadata
| A set of key/value pairs that you can attach to a plan object. It can be useful for storing additional information about the plan in a structured format. |