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;
$post = true;

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

//Execute cURL request
$ch = curl_init();
if ($post) {
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
} else {
    $url = $url . "?" . $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.


first_charge

This is the amount to charge today as part of the proration.