Class UsageRecord
- java.lang.Object
-
- com.stripe.model.StripeObject
-
- com.stripe.net.ApiResource
-
- com.stripe.model.UsageRecord
-
- All Implemented Interfaces:
HasId
,StripeObjectInterface
public class UsageRecord extends ApiResource implements HasId
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.stripe.net.ApiResource
ApiResource.RequestMethod
-
-
Field Summary
-
Fields inherited from class com.stripe.net.ApiResource
CHARSET, GSON
-
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
-
Constructor Summary
Constructors Constructor Description UsageRecord()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(java.lang.Object other)
static UsageRecord
createOnSubscriptionItem(java.lang.String subscriptionItem, UsageRecordCreateOnSubscriptionItemParams params, RequestOptions options)
Creates a usage record for a specified subscription item and date, and fills it with a quantity.static UsageRecord
createOnSubscriptionItem(java.lang.String subscriptionItem, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options)
Creates a usage record for a specified subscription item and date, and fills it with a quantity.boolean
equals(java.lang.Object o)
java.lang.String
getId()
Unique identifier for the object.java.lang.Boolean
getLivemode()
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.java.lang.String
getObject()
String representing the object's type.java.lang.Long
getQuantity()
The usage quantity for the specified date.java.lang.String
getSubscriptionItem()
The ID of the subscription item this usage record contains data for.java.lang.Long
getTimestamp()
The timestamp when this usage occurred.int
hashCode()
void
setId(java.lang.String id)
Unique identifier for the object.void
setLivemode(java.lang.Boolean livemode)
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.void
setObject(java.lang.String object)
String representing the object's type.void
setQuantity(java.lang.Long quantity)
The usage quantity for the specified date.void
setSubscriptionItem(java.lang.String subscriptionItem)
The ID of the subscription item this usage record contains data for.void
setTimestamp(java.lang.Long timestamp)
The timestamp when this usage occurred.-
Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, classUrl, classUrl, instanceUrl, instanceUrl, request, request, requestCollection, requestCollection, setExpandableFieldId, setStripeResponseGetter, singleClassUrl, singleClassUrl, subresourceUrl, urlEncode, urlEncodeId
-
Methods inherited from class com.stripe.model.StripeObject
equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
-
-
-
-
Method Detail
-
createOnSubscriptionItem
public static UsageRecord createOnSubscriptionItem(java.lang.String subscriptionItem, java.util.Map<java.lang.String,java.lang.Object> params, RequestOptions options) throws StripeException
Creates a usage record for a specified subscription item and date, and fills it with a quantity.Usage records provide
quantity
information that Stripe uses to track how much a customer is using your service. With usage information and the pricing model set up by the metered billing plan, Stripe helps you send accurate invoices to your customers.The default calculation for usage is to add up all the
quantity
values of the usage records within a billing period. You can change this default behavior with the billing plan’saggregate_usage
parameter. When there is more than one usage record with the same timestamp, Stripe adds thequantity
values together. In most cases, this is the desired resolution, however, you can change this behavior with theaction
parameter.The default pricing model for metered billing is per-unit pricing. For finer granularity, you can configure metered billing to have a tiered pricing model.
- Throws:
StripeException
-
createOnSubscriptionItem
public static UsageRecord createOnSubscriptionItem(java.lang.String subscriptionItem, UsageRecordCreateOnSubscriptionItemParams params, RequestOptions options) throws StripeException
Creates a usage record for a specified subscription item and date, and fills it with a quantity.Usage records provide
quantity
information that Stripe uses to track how much a customer is using your service. With usage information and the pricing model set up by the metered billing plan, Stripe helps you send accurate invoices to your customers.The default calculation for usage is to add up all the
quantity
values of the usage records within a billing period. You can change this default behavior with the billing plan’saggregate_usage
parameter. When there is more than one usage record with the same timestamp, Stripe adds thequantity
values together. In most cases, this is the desired resolution, however, you can change this behavior with theaction
parameter.The default pricing model for metered billing is per-unit pricing. For finer granularity, you can configure metered billing to have a tiered pricing model.
- Throws:
StripeException
-
getLivemode
public java.lang.Boolean getLivemode()
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.
-
getObject
public java.lang.String getObject()
String representing the object's type. Objects of the same type share the same value.Equal to
usage_record
.
-
getQuantity
public java.lang.Long getQuantity()
The usage quantity for the specified date.
-
getSubscriptionItem
public java.lang.String getSubscriptionItem()
The ID of the subscription item this usage record contains data for.
-
getTimestamp
public java.lang.Long getTimestamp()
The timestamp when this usage occurred.
-
setId
public void setId(java.lang.String id)
Unique identifier for the object.
-
setLivemode
public void setLivemode(java.lang.Boolean livemode)
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.
-
setObject
public void setObject(java.lang.String object)
String representing the object's type. Objects of the same type share the same value.Equal to
usage_record
.
-
setQuantity
public void setQuantity(java.lang.Long quantity)
The usage quantity for the specified date.
-
setSubscriptionItem
public void setSubscriptionItem(java.lang.String subscriptionItem)
The ID of the subscription item this usage record contains data for.
-
setTimestamp
public void setTimestamp(java.lang.Long timestamp)
The timestamp when this usage occurred.
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
canEqual
protected boolean canEqual(java.lang.Object other)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-