Skip to main content
PATCH
Update a Subscription
This endpoint does two different jobs, and one request may do only one of them.
  • Edit fields. metadata, failure_policy and retry_offsets_days can be changed at any time.
  • Change the plan. Send product_id, optionally with quantity.
product_id cannot be combined with the editable fields, and quantity requires product_id. Both combinations are rejected with 422 so that no part of the request is silently dropped. Amount, interval and currency are not edited directly — they come from the plan, and they change when the plan changes. A subscription.updated webhook is dispatched in every case. On a Pix Automático subscription, plan changes are not available: sending product_id returns 422 and the plan stays the same (PLAN_CHANGE_UNAVAILABLE_FOR_PAYMENT_METHOD when the subscription is tied to a catalog plan). retry_offsets_days is stored but has no effect there, because retry timing follows the Pix Automático rules.

Which plans a subscription can move to

A subscription can only change plans when it is already tied to a catalog plan. Check productId first: when it is null, no plan change is possible. The target must be an active plan in the same product family as the current one — productFamilyId tells you which family that is. A target in another family, or a product that is not a recurring plan, is rejected before anything is charged or written.

What happens, and when the customer is charged

The billing cycle takes precedence: moving between plans billed on different cycles is always immediate and always charges the full price, whichever tier the target is. When a charge is declined, the plan does not change — the request fails with 402 and the subscription is left exactly as it was. When the charge returns no result at all — a timeout, for instance — the outcome is unknown rather than a decline, so the request fails with 409 PLAN_CHARGE_INDETERMINATE instead. The plan does not change. Retry the same change once the charge settles; retrying it earlier is refused, because the charge may already have gone through.

Scheduled changes

A change scheduled for the end of the period is visible in pendingChange, with the target plan, the amount that will be billed — the plan plus anything billed alongside it — and the date it takes effect. Its price is fixed when you schedule it, so later edits to the plan do not alter what was agreed. To cancel a scheduled change, send product_id with the plan the subscription is currently on. pendingChange returns to null.

Response fields

Errors

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string<uuid>
required

Public subscription id (UUID).

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$

Body

application/json
metadata
object | null
failure_policy
enum<string>
Available options:
immediate_cancel,
retry_then_cancel
retry_offsets_days
integer[]
Required array length: 1 - 10 elements
Required range: 1 <= x <= 30
product_id
string<uuid>

Public id of a catalog product in the same family. Changes the subscription's plan.

Pattern: ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
quantity
integer

Quantity for the new plan. Omitted keeps the current one.

Required range: 1 <= x <= 999999

Response

Success

success
boolean
required
requestId
string
required
data
object
required