Paddle.OneOffCharge (paddlex v0.2.0)

Copy Markdown View Source

Make immediate one-off charges on top of an existing subscription.

Summary

Functions

Make an immediate one-off charge on top of an existing user subscription This feature is useful for scenarios where buyers need to purchase add-ons on top of a recurring plan.

Types

t()

@type t() :: %Paddle.OneOffCharge{
  amount: number(),
  currency: String.t(),
  invoice_id: integer(),
  order_id: String.t(),
  payment_date: Date.t(),
  receipt_url: String.t(),
  subscription_id: integer()
}

Functions

create(subscription_id, amount, charge_name, opts \\ [])

@spec create(integer(), number(), String.t(), keyword()) ::
  {:ok, t()} | {:error, Paddle.Error.t()}

Make an immediate one-off charge on top of an existing user subscription This feature is useful for scenarios where buyers need to purchase add-ons on top of a recurring plan.

For example, Charges API provides you with the flexibility to charge buyers, with existing subscriptions, right away for one-off top-ups, rather than waiting for the end of their current billing cycle.

Example

Paddle.OneOffCharge.create(2746, 10, "TestCharge") 
{:ok, %Paddle.OneOffCharge{
  invoice_id: 1,
  subscription_id: 1,
  amount: "10.00",
  currency: "USD",
  payment_date: ~D"2018-09-21",
  receipt_url: "https://my.paddle.com/receipt/1-1/3-chre8a53a2724c6-42781cb91a"
}}