<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS');
header('Access-Control-Allow-Headers: X-Requested-With, content-type, X-Token, x-token');
require_once('vendor/autoload.php');
\Stripe\Stripe::setApiKey("sk_live_ZiEp14EJoCJwGVhQXqOt1soN");

$subscription = \Stripe\Subscription::retrieve($_POST['id'], array("stripe_account" => $_POST['stripeId']));
$subscription->cancel(array('at_period_end' => true));
?>