Subscriptions Admin API
Change the plan of a customer's active subscription
POST
/api/v1/customers/{uid}/change-plan/{plan_uid}
What happens depends on the subscription:
- free change, or one the payment provider applies itself: done (
Plan changed…); - a change to pay for: an invoice is created, which the customer pays from the web interface;
- the provider asks the customer to confirm the payment:
hosted_invoice_urlis where to send them; - the saved card cannot pay: 402, and nothing changes.
Parameters
uid
string
required
path
The customer's uid.
plan_uid
string
required
path
The plan's uid.
Responses
200
The plan changed, or is waiting for a payment.
401
The token is missing or wrong (
Unauthenticated.), or its user may not act on
this object (Unauthorized). Without the Accept: application/json header, a
missing or wrong token answers with a redirect to the sign-in page instead.
402
The saved card cannot pay; the change was dropped.
404
No customer or no plan has this uid, the plan is not active, or the customer has no active subscription.
500
The change failed; the message says why.
Change the plan of a customer's active subscription
1
2
3
curl -X POST 'https://your-domain/api/v1/customers/6adaabb568fda/change-plan/6adaabb0c9e12' \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN"
Response
{
"status": 1,
"message": "Plan changed",
"customer_uid": "6adaabb568fda",
"plan_uid": "6adaabb0c9e12"
}