View Source Stripe.Billing.CreditGrant (stripity_stripe v3.3.1)
A credit grant is an API resource that documents the allocation of some billing credits to a customer.
Related guide: Billing credits
Summary
Types
Amount of this credit grant.
Configuration specifying what this credit grant applies to. We currently only support metered prices that have a Billing Meter attached to them.
The monetary amount.
Specify the scope of this applicability config.
The billing.credit_grant type.
Functions
Creates a credit grant.
Expires a credit grant.
Retrieve a list of credit grants.
Retrieves a credit grant.
Updates a credit grant.
Voids a credit grant.
Types
@type amount() :: %{optional(:monetary) => monetary(), optional(:type) => :monetary}
Amount of this credit grant.
@type applicability_config() :: %{optional(:scope) => scope()}
Configuration specifying what this credit grant applies to. We currently only support metered prices that have a Billing Meter attached to them.
The monetary amount.
@type prices() :: %{optional(:id) => binary()}
@type scope() :: %{optional(:price_type) => :metered, optional(:prices) => [prices()]}
Specify the scope of this applicability config.
@type t() :: %Stripe.Billing.CreditGrant{ amount: term(), applicability_config: term(), category: binary(), created: integer(), customer: binary() | Stripe.Customer.t() | Stripe.DeletedCustomer.t(), effective_at: integer() | nil, expires_at: integer() | nil, id: binary(), livemode: boolean(), metadata: term(), name: binary() | nil, object: binary(), priority: integer() | nil, test_clock: (binary() | Stripe.TestHelpers.TestClock.t()) | nil, updated: integer(), voided_at: integer() | nil }
The billing.credit_grant type.
amountapplicability_configcategoryThe category of this credit grant. This is for tracking purposes and isn't displayed to the customer.createdTime at which the object was created. Measured in seconds since the Unix epoch.customerID of the customer receiving the billing credits.effective_atThe time when the billing credits become effective-when they're eligible for use.expires_atThe time when the billing credits expire. If not present, the billing credits don't expire.idUnique identifier for the object.livemodeHas the valuetrueif the object exists in live mode or the valuefalseif the object exists in test mode.metadataSet of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.nameA descriptive name shown in dashboard.objectString representing the object's type. Objects of the same type share the same value.priorityThe priority for applying this credit grant. The highest priority is 0 and the lowest is 100.test_clockID of the test clock this credit grant belongs to.updatedTime at which the object was last updated. Measured in seconds since the Unix epoch.voided_atThe time when this credit grant was voided. If not present, the credit grant hasn't been voided.
Functions
@spec create( params :: %{ optional(:amount) => amount(), optional(:applicability_config) => applicability_config(), optional(:category) => :paid | :promotional, optional(:customer) => binary(), optional(:effective_at) => integer(), optional(:expand) => [binary()], optional(:expires_at) => integer(), optional(:metadata) => %{optional(binary()) => binary()}, optional(:name) => binary(), optional(:priority) => integer() }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Creates a credit grant.
Details
- Method:
post - Path:
/v1/billing/credit_grants
@spec expire( id :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Expires a credit grant.
Details
- Method:
post - Path:
/v1/billing/credit_grants/{id}/expire
@spec list( params :: %{ optional(:customer) => binary(), optional(:ending_before) => binary(), optional(:expand) => [binary()], optional(:limit) => integer(), optional(:starting_after) => binary() }, opts :: Keyword.t() ) :: {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieve a list of credit grants.
Details
- Method:
get - Path:
/v1/billing/credit_grants
@spec retrieve( id :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Retrieves a credit grant.
Details
- Method:
get - Path:
/v1/billing/credit_grants/{id}
@spec update( id :: binary(), params :: %{ optional(:expand) => [binary()], optional(:expires_at) => integer() | binary(), optional(:metadata) => %{optional(binary()) => binary()} }, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Updates a credit grant.
Details
- Method:
post - Path:
/v1/billing/credit_grants/{id}
@spec void_grant( id :: binary(), params :: %{optional(:expand) => [binary()]}, opts :: Keyword.t() ) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}
Voids a credit grant.
Details
- Method:
post - Path:
/v1/billing/credit_grants/{id}/void