Subscriptions Admin API

Assign a plan to a customer

POST /api/v1/customers/{uid}/assign-plan/{plan_uid}

Gives the customer a new subscription to the plan. With force, a subscription the customer has now is ended first, in the same step. The subscription waits for its first invoice to be paid, unless disable_billing is true.

Parameters
uid string required path
The customer's uid.
plan_uid string required path
The plan's uid.
Request body application/x-www-form-urlencoded
force boolean
End the customer's current subscription first.
Default: 0
disable_billing boolean
Activate the subscription without an invoice to pay.
Default: 0
Responses
200 The plan was assigned.
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.
404 No customer or no plan has this uid, or the plan is not active.
500 The plan could not be assigned; the message says why, and nothing changed.
Assign a plan to a customer
1 2 3 4 5
curl -X POST 'https://your-domain/api/v1/customers/6adaabb568fda/assign-plan/6adaabb0c9e12' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  --data-urlencode 'force=1' \
  --data-urlencode 'disable_billing=1'
1 2
$client = new Acelle\Client('https://your-domain/api/v1', 'YOUR_API_TOKEN');
$client->customer()->assignPlan('6adaabb568fda', '6adaabb0c9e12');
Response
{
    "status": 1,
    "message": "Assigned Awesome Solutions plan to Standard successfully.",
    "customer_uid": "6adaabb568fda",
    "plan_uid": "6adaabb0c9e12"
}