Usage extends RecurlyResource
Table of Contents
- $array_hints : mixed
- $_amount : mixed
- $_billed_at : mixed
- $_created_at : mixed
- $_id : mixed
- $_measured_unit_id : mixed
- $_merchant_tag : mixed
- $_object : mixed
- $_percentage_tiers : mixed
- $_recording_timestamp : mixed
- $_response : mixed
- $_tier_type : mixed
- $_tiers : mixed
- $_unit_amount : mixed
- $_unit_amount_decimal : mixed
- $_updated_at : mixed
- $_usage_percentage : mixed
- $_usage_timestamp : mixed
- $_usage_type : mixed
- __construct() : mixed
- Constructor
- __debugInfo() : array<string|int, mixed>
- Override of the magic method __debugInfo that will only return the relevant attributes of the \Recurly\RecurlyResource
- __set() : void
- Guard against setting invalid properties
- cast() : RecurlyResource
- Recursively converts a response object into a \Recurly\RecurlyResource.
- fromBinary() : BinaryFile
- Converts a binary response into a Recurly BinaryFile
- fromEmpty() : EmptyResource
- Returns a \Recurly\EmptyResource for API requests that do not have a response body.
- fromResponse() : RecurlyResource
- Converts a Recurly response object into a \Recurly\RecurlyResource.
- getAmount() : float|null
- Getter method for the amount attribute.
- getBilledAt() : string|null
- Getter method for the billed_at attribute.
- getCreatedAt() : string|null
- Getter method for the created_at attribute.
- getId() : string|null
- Getter method for the id attribute.
- getMeasuredUnitId() : string|null
- Getter method for the measured_unit_id attribute.
- getMerchantTag() : string|null
- Getter method for the merchant_tag attribute.
- getObject() : string|null
- Getter method for the object attribute.
- getPercentageTiers() : array<string|int, mixed>
- Getter method for the percentage_tiers attribute.
- getRecordingTimestamp() : string|null
- Getter method for the recording_timestamp attribute.
- getResponse() : Response
- Getter for the Recurly HTTP Response
- getTiers() : array<string|int, mixed>
- Getter method for the tiers attribute.
- getTierType() : string|null
- Getter method for the tier_type attribute.
- getUnitAmount() : float|null
- Getter method for the unit_amount attribute.
- getUnitAmountDecimal() : string|null
- Getter method for the unit_amount_decimal attribute.
- getUpdatedAt() : string|null
- Getter method for the updated_at attribute.
- getUsagePercentage() : float|null
- Getter method for the usage_percentage attribute.
- getUsageTimestamp() : string|null
- Getter method for the usage_timestamp attribute.
- getUsageType() : string|null
- Getter method for the usage_type attribute.
- setAmount() : void
- Setter method for the amount attribute.
- setBilledAt() : void
- Setter method for the billed_at attribute.
- setCreatedAt() : void
- Setter method for the created_at attribute.
- setId() : void
- Setter method for the id attribute.
- setMeasuredUnitId() : void
- Setter method for the measured_unit_id attribute.
- setMerchantTag() : void
- Setter method for the merchant_tag attribute.
- setObject() : void
- Setter method for the object attribute.
- setPercentageTiers() : void
- Setter method for the percentage_tiers attribute.
- setRecordingTimestamp() : void
- Setter method for the recording_timestamp attribute.
- setTiers() : void
- Setter method for the tiers attribute.
- setTierType() : void
- Setter method for the tier_type attribute.
- setUnitAmount() : void
- Setter method for the unit_amount attribute.
- setUnitAmountDecimal() : void
- Setter method for the unit_amount_decimal attribute.
- setUpdatedAt() : void
- Setter method for the updated_at attribute.
- setUsagePercentage() : void
- Setter method for the usage_percentage attribute.
- setUsageTimestamp() : void
- Setter method for the usage_timestamp attribute.
- setUsageType() : void
- Setter method for the usage_type attribute.
- encodeApiKey() : string
- Base64 encodes the API key
- getUserAgent() : string
- Generates User-Agent for API requests
- hintArrayType() : string
- The hintArrayType method will provide type hinting for setter methods that have array parameters.
- resourceClass() : string
- Converts a string into a representation of a Recurly Resource
- setResponse() : void
- Setter for the Recurly HTTP Response
- setterParamClass() : string
- Uses the Reflection API to determine what \Recurly\RecurlyResource is the expected parameter for the given method.
- titleize() : string
- Capitalizes all the words in the $input.
Properties
$array_hints
protected
static mixed
$array_hints
= ['setPercentageTiers' => '\Recurly\Resources\SubscriptionAddOnPercentageTier', 'setTiers' => '\Recurly\Resources\SubscriptionAddOnTier']
$_amount
private
mixed
$_amount
$_billed_at
private
mixed
$_billed_at
$_created_at
private
mixed
$_created_at
$_id
private
mixed
$_id
$_measured_unit_id
private
mixed
$_measured_unit_id
$_merchant_tag
private
mixed
$_merchant_tag
$_object
private
mixed
$_object
$_percentage_tiers
private
mixed
$_percentage_tiers
$_recording_timestamp
private
mixed
$_recording_timestamp
$_response
private
mixed
$_response
$_tier_type
private
mixed
$_tier_type
$_tiers
private
mixed
$_tiers
$_unit_amount
private
mixed
$_unit_amount
$_unit_amount_decimal
private
mixed
$_unit_amount_decimal
$_updated_at
private
mixed
$_updated_at
$_usage_percentage
private
mixed
$_usage_percentage
$_usage_timestamp
private
mixed
$_usage_timestamp
$_usage_type
private
mixed
$_usage_type
Methods
__construct()
Constructor
public
final __construct() : mixed
Return values
mixed —__debugInfo()
Override of the magic method __debugInfo that will only return the relevant attributes of the \Recurly\RecurlyResource
public
__debugInfo() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —__set()
Guard against setting invalid properties
public
__set(string $key, mixed $value) : void
Parameters
- $key : string
-
The parameter name that is being set
- $value : mixed
-
The parameter value that is being set
Tags
Return values
void —cast()
Recursively converts a response object into a \Recurly\RecurlyResource.
public
static cast(object $data) : RecurlyResource
Parameters
- $data : object
-
PHP Object containing the decoded JSON
Return values
RecurlyResource —An instance of a Recurly Resource
fromBinary()
Converts a binary response into a Recurly BinaryFile
public
static fromBinary(string $data, Response $response) : BinaryFile
Parameters
- $data : string
-
The binary file data
- $response : Response
-
(optional) The Recurly HTTP Response
Return values
BinaryFile —An instance of a Recurly BinaryFile
fromEmpty()
Returns a \Recurly\EmptyResource for API requests that do not have a response body.
public
static fromEmpty(Response $response) : EmptyResource
Parameters
- $response : Response
-
(optional) The Recurly HTTP Response
Return values
EmptyResource —fromResponse()
Converts a Recurly response object into a \Recurly\RecurlyResource.
public
static fromResponse(Response $response[, object $json = null ]) : RecurlyResource
Parameters
- $response : Response
-
The Recurly HTTP Response
- $json : object = null
-
(optional) JSON payload to use instead of the $response's. Primarily used for errors
Return values
RecurlyResource —An instance of a Recurly Resource
getAmount()
Getter method for the amount attribute.
public
getAmount() : float|null
The amount of usage. Can be positive, negative, or 0. If the Decimal Quantity feature is enabled, this value will be rounded to nine decimal places. Otherwise, all digits after the decimal will be stripped. If the usage-based add-on is billed with a percentage, your usage should be a monetary amount formatted in cents (e.g., $5.00 is "500").
Return values
float|null —getBilledAt()
Getter method for the billed_at attribute.
public
getBilledAt() : string|null
When the usage record was billed on an invoice.
Return values
string|null —getCreatedAt()
Getter method for the created_at attribute.
public
getCreatedAt() : string|null
When the usage record was created in Recurly.
Return values
string|null —getId()
Getter method for the id attribute.
public
getId() : string|null
Return values
string|null —getMeasuredUnitId()
Getter method for the measured_unit_id attribute.
public
getMeasuredUnitId() : string|null
The ID of the measured unit associated with the add-on the usage record is for.
Return values
string|null —getMerchantTag()
Getter method for the merchant_tag attribute.
public
getMerchantTag() : string|null
Custom field for recording the id in your own system associated with the usage, so you can provide auditable usage displays to your customers using a GET on this endpoint.
Return values
string|null —getObject()
Getter method for the object attribute.
public
getObject() : string|null
Object type
Return values
string|null —getPercentageTiers()
Getter method for the percentage_tiers attribute.
public
getPercentageTiers() : array<string|int, mixed>
The percentage tiers of the subscription based on the usage_timestamp. If tier_type = flat, percentage_tiers = []. This feature is currently in development and requires approval and enablement, please contact support.
Return values
array<string|int, mixed> —getRecordingTimestamp()
Getter method for the recording_timestamp attribute.
public
getRecordingTimestamp() : string|null
When the usage was recorded in your system.
Return values
string|null —getResponse()
Getter for the Recurly HTTP Response
public
getResponse() : Response
Return values
Response —The Recurly HTTP Response
getTiers()
Getter method for the tiers attribute.
public
getTiers() : array<string|int, mixed>
The tiers and prices of the subscription based on the usage_timestamp. If tier_type = flat, tiers = []
Return values
array<string|int, mixed> —getTierType()
Getter method for the tier_type attribute.
public
getTierType() : string|null
The pricing model for the add-on. For more information, click here. See our Guide for an overview of how to configure quantity-based pricing models.
Return values
string|null —getUnitAmount()
Getter method for the unit_amount attribute.
public
getUnitAmount() : float|null
Unit price
Return values
float|null —getUnitAmountDecimal()
Getter method for the unit_amount_decimal attribute.
public
getUnitAmountDecimal() : string|null
Unit price that can optionally support a sub-cent value.
Return values
string|null —getUpdatedAt()
Getter method for the updated_at attribute.
public
getUpdatedAt() : string|null
When the usage record was billed on an invoice.
Return values
string|null —getUsagePercentage()
Getter method for the usage_percentage attribute.
public
getUsagePercentage() : float|null
The percentage taken of the monetary amount of usage tracked. This can be up to 4 decimal places. A value between 0.0 and 100.0.
Return values
float|null —getUsageTimestamp()
Getter method for the usage_timestamp attribute.
public
getUsageTimestamp() : string|null
When the usage actually happened. This will define the line item dates this usage is billed under and is important for revenue recognition.
Return values
string|null —getUsageType()
Getter method for the usage_type attribute.
public
getUsageType() : string|null
Type of usage, returns usage type if add_on_type
is usage
.
Return values
string|null —setAmount()
Setter method for the amount attribute.
public
setAmount(float $amount) : void
Parameters
- $amount : float
Return values
void —setBilledAt()
Setter method for the billed_at attribute.
public
setBilledAt(string $billed_at) : void
Parameters
- $billed_at : string
Return values
void —setCreatedAt()
Setter method for the created_at attribute.
public
setCreatedAt(string $created_at) : void
Parameters
- $created_at : string
Return values
void —setId()
Setter method for the id attribute.
public
setId(string $id) : void
Parameters
- $id : string
Return values
void —setMeasuredUnitId()
Setter method for the measured_unit_id attribute.
public
setMeasuredUnitId(string $measured_unit_id) : void
Parameters
- $measured_unit_id : string
Return values
void —setMerchantTag()
Setter method for the merchant_tag attribute.
public
setMerchantTag(string $merchant_tag) : void
Parameters
- $merchant_tag : string
Return values
void —setObject()
Setter method for the object attribute.
public
setObject(string $object) : void
Parameters
- $object : string
Return values
void —setPercentageTiers()
Setter method for the percentage_tiers attribute.
public
setPercentageTiers(array<string|int, mixed> $percentage_tiers) : void
Parameters
- $percentage_tiers : array<string|int, mixed>
Return values
void —setRecordingTimestamp()
Setter method for the recording_timestamp attribute.
public
setRecordingTimestamp(string $recording_timestamp) : void
Parameters
- $recording_timestamp : string
Return values
void —setTiers()
Setter method for the tiers attribute.
public
setTiers(array<string|int, mixed> $tiers) : void
Parameters
- $tiers : array<string|int, mixed>
Return values
void —setTierType()
Setter method for the tier_type attribute.
public
setTierType(string $tier_type) : void
Parameters
- $tier_type : string
Return values
void —setUnitAmount()
Setter method for the unit_amount attribute.
public
setUnitAmount(float $unit_amount) : void
Parameters
- $unit_amount : float
Return values
void —setUnitAmountDecimal()
Setter method for the unit_amount_decimal attribute.
public
setUnitAmountDecimal(string $unit_amount_decimal) : void
Parameters
- $unit_amount_decimal : string
Return values
void —setUpdatedAt()
Setter method for the updated_at attribute.
public
setUpdatedAt(string $updated_at) : void
Parameters
- $updated_at : string
Return values
void —setUsagePercentage()
Setter method for the usage_percentage attribute.
public
setUsagePercentage(float $usage_percentage) : void
Parameters
- $usage_percentage : float
Return values
void —setUsageTimestamp()
Setter method for the usage_timestamp attribute.
public
setUsageTimestamp(string $usage_timestamp) : void
Parameters
- $usage_timestamp : string
Return values
void —setUsageType()
Setter method for the usage_type attribute.
public
setUsageType(string $usage_type) : void
Parameters
- $usage_type : string
Return values
void —encodeApiKey()
Base64 encodes the API key
protected
static encodeApiKey(string $key) : string
Parameters
- $key : string
-
The API key to encode
Return values
string —base64 encoded API key
getUserAgent()
Generates User-Agent for API requests
protected
static getUserAgent() : string
Return values
string —Recurly client User-Agent string
hintArrayType()
The hintArrayType method will provide type hinting for setter methods that have array parameters.
protected
static hintArrayType(string $key) : string
Parameters
- $key : string
-
The property to get teh type hint for.
Return values
string —The class name of the expected array type.
resourceClass()
Converts a string into a representation of a Recurly Resource
protected
static resourceClass(string $type) : string
Parameters
- $type : string
-
A string to convert to a Recurly Resource
Return values
string —The string representation of a Recurly Resource
setResponse()
Setter for the Recurly HTTP Response
protected
setResponse(Response $response) : void
Parameters
- $response : Response
-
The Recurly HTTP Response
Return values
void —setterParamClass()
Uses the Reflection API to determine what \Recurly\RecurlyResource is the expected parameter for the given method.
protected
static setterParamClass(string $method) : string
Parameters
- $method : string
-
The name of the setter method to find the type hint for
Return values
string —The \Recurly\RecurlyResource that the setter method expects
titleize()
Capitalizes all the words in the $input.
protected
static titleize(string $input[, string $prefix = '' ]) : string
Parameters
- $input : string
-
The string to titleize
- $prefix : string = ''
-
(optional) Prefix to add to the beginning of the titleized string. The prefix will not be titleized.
Return values
string —The titleized $input wtih the prepended $prefix