View Source Stripe.Topup (stripity_stripe v3.1.1)

To top up your Stripe balance, you create a top-up object. You can retrieve individual top-ups, as well as list all top-ups. Top-ups are identified by a unique, random ID.

Related guide: Topping up your platform account

Link to this section Summary

Types

t()

The topup type.

Functions

Cancels a top-up. Only pending top-ups can be canceled.

Top up the balance of an account

Returns a list of top-ups.

Retrieves the details of a top-up that has previously been created. Supply the unique top-up ID that was returned from your previous request, and Stripe will return the corresponding top-up information.

Updates the metadata of a top-up. Other top-up details are not editable by design.

Link to this section Types

@type amount() :: %{
  optional(:gt) => integer(),
  optional(:gte) => integer(),
  optional(:lt) => integer(),
  optional(:lte) => integer()
}
@type created() :: %{
  optional(:gt) => integer(),
  optional(:gte) => integer(),
  optional(:lt) => integer(),
  optional(:lte) => integer()
}
@type t() :: %Stripe.Topup{
  amount: integer(),
  balance_transaction: (binary() | Stripe.BalanceTransaction.t()) | nil,
  created: integer(),
  currency: binary(),
  description: binary() | nil,
  expected_availability_date: integer() | nil,
  failure_code: binary() | nil,
  failure_message: binary() | nil,
  id: binary(),
  livemode: boolean(),
  metadata: term(),
  object: binary(),
  source: Stripe.Source.t() | nil,
  statement_descriptor: binary() | nil,
  status: binary(),
  transfer_group: binary() | nil
}

The topup type.

  • amount Amount transferred.
  • balance_transaction ID of the balance transaction that describes the impact of this top-up on your account balance. May not be specified depending on status of top-up.
  • created Time at which the object was created. Measured in seconds since the Unix epoch.
  • currency Three-letter ISO currency code, in lowercase. Must be a supported currency.
  • description An arbitrary string attached to the object. Often useful for displaying to users.
  • expected_availability_date Date the funds are expected to arrive in your Stripe account for payouts. This factors in delays like weekends or bank holidays. May not be specified depending on status of top-up.
  • failure_code Error code explaining reason for top-up failure if available (see the errors section for a list of codes).
  • failure_message Message to user further explaining reason for top-up failure if available.
  • id Unique identifier for the object.
  • livemode Has the value true if the object exists in live mode or the value false if the object exists in test mode.
  • metadata Set 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.
  • object String representing the object's type. Objects of the same type share the same value.
  • source The source field is deprecated. It might not always be present in the API response.
  • statement_descriptor Extra information about a top-up. This will appear on your source's bank statement. It must contain at least one letter.
  • status The status of the top-up is either canceled, failed, pending, reversed, or succeeded.
  • transfer_group A string that identifies this top-up as part of a group.

Link to this section Functions

Link to this function

cancel(topup, params \\ %{}, opts \\ [])

View Source
@spec cancel(
  topup :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Cancels a top-up. Only pending top-ups can be canceled.

Details

  • Method: post
  • Path: /v1/topups/{topup}/cancel
Link to this function

create(params \\ %{}, opts \\ [])

View Source
@spec create(
  params :: %{
    optional(:amount) => integer(),
    optional(:currency) => binary(),
    optional(:description) => binary(),
    optional(:expand) => [binary()],
    optional(:metadata) => %{optional(binary()) => binary()} | binary(),
    optional(:source) => binary(),
    optional(:statement_descriptor) => binary(),
    optional(:transfer_group) => binary()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Top up the balance of an account

Details

  • Method: post
  • Path: /v1/topups
Link to this function

list(params \\ %{}, opts \\ [])

View Source
@spec list(
  params :: %{
    optional(:amount) => amount() | integer(),
    optional(:created) => created() | integer(),
    optional(:ending_before) => binary(),
    optional(:expand) => [binary()],
    optional(:limit) => integer(),
    optional(:starting_after) => binary(),
    optional(:status) => :canceled | :failed | :pending | :succeeded
  },
  opts :: Keyword.t()
) ::
  {:ok, Stripe.List.t(t())} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Returns a list of top-ups.

Details

  • Method: get
  • Path: /v1/topups
Link to this function

retrieve(topup, params \\ %{}, opts \\ [])

View Source
@spec retrieve(
  topup :: binary(),
  params :: %{optional(:expand) => [binary()]},
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Retrieves the details of a top-up that has previously been created. Supply the unique top-up ID that was returned from your previous request, and Stripe will return the corresponding top-up information.

Details

  • Method: get
  • Path: /v1/topups/{topup}
Link to this function

update(topup, params \\ %{}, opts \\ [])

View Source
@spec update(
  topup :: binary(),
  params :: %{
    optional(:description) => binary(),
    optional(:expand) => [binary()],
    optional(:metadata) => %{optional(binary()) => binary()} | binary()
  },
  opts :: Keyword.t()
) :: {:ok, t()} | {:error, Stripe.ApiErrors.t()} | {:error, term()}

Updates the metadata of a top-up. Other top-up details are not editable by design.

Details

  • Method: post
  • Path: /v1/topups/{topup}