Class UsageRecord
- All Implemented Interfaces:
HasId
,StripeActiveObject
,StripeObjectInterface
Related guide: Metered billing
This is our legacy usage-based billing API. See the updated usage-based billing docs.
-
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, INTERNAL_GSON
Fields inherited from class com.stripe.model.StripeObject
PRETTY_PRINT_GSON
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
static UsageRecord
createOnSubscriptionItem
(String subscriptionItem, UsageRecordCreateOnSubscriptionItemParams params) Creates a usage record for a specified subscription item and date, and fills it with a quantity.static UsageRecord
createOnSubscriptionItem
(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
(String subscriptionItem, Map<String, Object> params) Creates a usage record for a specified subscription item and date, and fills it with a quantity.static UsageRecord
createOnSubscriptionItem
(String subscriptionItem, Map<String, Object> params, RequestOptions options) Creates a usage record for a specified subscription item and date, and fills it with a quantity.boolean
getId()
Unique identifier for the object.Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.String representing the object's type.The usage quantity for the specified date.The ID of the subscription item this usage record contains data for.The timestamp when this usage occurred.int
hashCode()
void
Unique identifier for the object.void
setLivemode
(Boolean livemode) Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode.void
String representing the object's type.void
setQuantity
(Long quantity) The usage quantity for the specified date.void
setSubscriptionItem
(String subscriptionItem) The ID of the subscription item this usage record contains data for.void
setTimestamp
(Long timestamp) The timestamp when this usage occurred.Methods inherited from class com.stripe.net.ApiResource
checkNullTypedParams, getGlobalResponseGetter, getResponseGetter, setExpandableFieldId, setResponseGetter, setStripeResponseGetter, urlEncode, urlEncodeId
Methods inherited from class com.stripe.model.StripeObject
deserializeStripeObject, deserializeStripeObject, deserializeStripeObject, equals, getLastResponse, getRawJsonObject, setLastResponse, toJson, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.stripe.model.StripeActiveObject
trySetResponseGetter
-
Constructor Details
-
UsageRecord
public UsageRecord()
-
-
Method Details
-
createOnSubscriptionItem
public static UsageRecord createOnSubscriptionItem(String subscriptionItem, Map<String, Object> params) throws StripeExceptionCreates 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(String subscriptionItem, Map<String, Object> params, RequestOptions options) throws StripeExceptionCreates 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(String subscriptionItem, UsageRecordCreateOnSubscriptionItemParams params) 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(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
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
getObject
String representing the object's type. Objects of the same type share the same value.Equal to
usage_record
. -
getQuantity
The usage quantity for the specified date. -
getSubscriptionItem
The ID of the subscription item this usage record contains data for. -
getTimestamp
The timestamp when this usage occurred. -
setId
Unique identifier for the object. -
setLivemode
Has the valuetrue
if the object exists in live mode or the valuefalse
if the object exists in test mode. -
setObject
String representing the object's type. Objects of the same type share the same value.Equal to
usage_record
. -
setQuantity
The usage quantity for the specified date. -
setSubscriptionItem
The ID of the subscription item this usage record contains data for. -
setTimestamp
The timestamp when this usage occurred. -
equals
-
canEqual
-
hashCode
public int hashCode() -
getId
Unique identifier for the object.
-