Cancel Subscription

Example Request

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

//Create request data string
$data = http_build_query([
    'auth_token' => '3A0GTRFIJHYE',
    'invoice_id' => 'PK-PORW20JQE5',
    'cancel_at'  => 1535702710,
    'fire_event' => 1
]);

//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

{
  "success": 1,
  "message": "Subscription was cancelled"
}

This POST request cancels an active subscription

ARGUMENTS

invoice_id

The unique Paykickstart purchase ID


auth_token

The Paykickstart vendor’s API Key


fire_event

Toggle whether or not Paykickstart should fire all the subscription cancellation events. This field is not required and default is 1 (true).


cancel_at

Optional field to set a specific cancellation date (unix timestamp).