Updates a subscription using its ID. Required for changes like billing date, items, or proration.

paddle_update_subscription(
  id,
  customer_id = NULL,
  address_id = NULL,
  business_id = NULL,
  currency_code = NULL,
  next_billed_at = NULL,
  discount = NULL,
  collection_mode = NULL,
  billing_details = NULL,
  items = NULL,
  proration_billing_mode = NULL,
  on_payment_failure = NULL,
  custom_data = NULL,
  scheduled_change = NULL
)

Arguments

id

Character. Required. The ID of the subscription (e.g. "sub_abc123").

customer_id

Character. Optional. Paddle customer ID.

address_id

Character. Optional. Paddle address ID.

business_id

Character or NULL. Optional.

currency_code

Character. Optional. Supported: "USD", "EUR", "GBP" (for manual collection).

next_billed_at

Character. Optional. RFC 3339 datetime string.

discount

List or NULL. Optional. Must include `id` (string) and `effective_from` (string, must be one of `"immediately"` or `"next_billing_period`), or NULL to remove.

collection_mode

Character. Optional. One of: `"automatic"`, `"manual"`.

billing_details

List or NULL. Required if `collection_mode` is "manual", NULL if changing collection_mode to automatic. Must include `enable_checkout` (boolean), `purchase_order_number` (string), `payment_terms` (list with `interval` (`day`, `week`, `month` or `year`) and `frequency` (integer)) and optional `additional_information` (string)

items

List of item lists. Optional. Each must include `price_id` (string) and `quantity` (numeric). If updating an existing item and not changing the quantity, you may omit quantity.

proration_billing_mode

Character. Required when making changes that impact billing. Must be one of: `"prorated_immediately"`, `"prorated_next_billing_period"`, `"full_immediately"`, `"full_next_billing_period"` and `"do_not_bill"`.

on_payment_failure

Character. Optional. Must be one of: `"prevent_change"`, `"allow_change"`.

custom_data

Named list or NULL. Optional.

scheduled_change

NULL. Set to NULL to remove a scheduled change.

Value

A list with updated subscription entity and metadata.

Examples

if (FALSE) { # paddle_has_token()
set_paddle_mode("sandbox")
result <- paddle_update_subscription(
  id = "sub_123",
  custom_data = list(purpose = "example")
)
}