API Docs
Subscriptions
API ReferenceSubscriptionsUpdate

Update Subscription

Updates an existing subscription's plan or item price. Use this to upgrade or downgrade a customer to a different plan.

PUT /subscriptions/{subscription_id}/update

Path Parameters

ParameterTypeRequiredDescription
subscription_idstringYesThe unique identifier for the subscription.

Headers

HeaderTypeRequiredDescription
api-keystringYesYour secret API key.
X-Profile-IdstringYesProfile ID for authentication.

Body Parameters

ParameterTypeRequiredDescription
plan_idstringYesThe new plan ID to switch the subscription to.
item_price_idstringYesThe new item price ID associated with the plan (e.g. cbdemo_enterprise-suite-monthly).

Request Example

curl -X PUT 'https://api.sandbox.paychtec.com/subscriptions/sub_abc123/update' \  -H "Content-Type: application/json" \  -H "api-key: snd_YOUR_API_KEY" \  -H "X-Profile-Id: prof_12345" \  -d '{  "plan_id": "cbdemo_enterprise-suite",  "item_price_id": "cbdemo_enterprise-suite-monthly"}'

Response

{
  "id": "sub_abc123",
  "status": "active",
  "profile_id": "prof_12345",
  "merchant_id": "mer_abc123",
  "customer_id": "cust_123456789",
  "plan_id": "cbdemo_enterprise-suite",
  "item_price_id": "cbdemo_enterprise-suite-monthly",
  "merchant_reference_id": "mer_ref_123456789",
  "payment": {
    "payment_id": "pay_xyz789",
    "status": "succeeded",
    "amount": 9900,
    "currency": "USD",
    "payment_method_type": "credit"
  },
  "invoice": {
    "id": "inv_abc123",
    "subscription_id": "sub_abc123",
    "amount": 9900,
    "currency": "USD",
    "status": "invoice_paid"
  }
}

Response Fields

FieldTypeDescription
idstringUnique identifier for the subscription.
statusstringCurrent subscription status.
profile_idstringThe profile this subscription belongs to.
merchant_idstringThe merchant account identifier.
customer_idstringThe customer this subscription belongs to.
plan_idstringThe updated plan ID.
item_price_idstringThe updated item price ID.
merchant_reference_idstringYour own reference ID for this subscription, if set.
coupon_codestringCoupon code applied to this subscription, if any.
client_secretstringShort-lived token (15 min) for SDK authentication, if a new payment confirmation is required.
paymentobjectDetails of the most recent payment.
invoiceobjectDetails of the most recent invoice.

Subscription Statuses

StatusDescription
activeSubscription is live on the new plan.
pendingPlan change is pending activation.
unpaidPayment for the plan change failed.
cancelledSubscription was cancelled.
failedPlan update failed.

Error Responses

Status CodeDescription
400Invalid update data — check that both plan_id and item_price_id are provided and valid.
404Subscription not found — verify the subscription_id.