Up/Downgrade Subscription

Example Request

<?php
//Set up API path and method
$base_url = "https://app.paykickstart.com/api/";
$route = "subscriptions/change";
$url = $base_url . $route;

//Create request data string
$data = http_build_query([
    'auth_token'    => '3A0GTRFIJHYE',
    'invoice_id'    => 'PK-PORW20JQE5',
    'product_id'    => 2759,
    'charge_date'   => 1578827340,
    'first_charge'  => 10,
    'allowed_units' => 1000
]);

//Execute cURL request
$ch = curl_init();
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
$output = curl_exec($ch);
curl_close($ch);

//Output Response
echo json_decode($output);

Example Response

{
  "code": 200,
  "message": "Subscription was changed"
}

This POST request changes a subscription by activating the new subscription first, then cancelling the current subscription.

ARGUMENTS

auth_token

The Paykickstart vendor’s API Key


invoice_id

The unique Paykickstart purchase ID


product_id

The new product with which subscription should now be associated.


charge_date

The next time the customer will be charged for the subscription. This field is optional; if not provided then the next charge date will remain unchanged.


first_charge

This is the pro-rata amount to charge/credit immediately. To add a credit instead of a charge, pass a NEGATIVE value in this parameter. This field is not required; if not provided the system will automatically calculate the amount to charge or to credit.


allowed_units

If usage is enabled, this parameter allows you to provide the usage limit for the pro-rata period. This field is not required; if not provided the system will automatically calculate it.