27 lines
1.2 KiB
PHP
Executable File
27 lines
1.2 KiB
PHP
Executable File
<?php
|
|
$nomFicAppelant = basename(__FILE__);
|
|
// -----------------------------------------------------
|
|
// Init
|
|
// -----------------------------------------------------
|
|
//
|
|
|
|
// -----------------------------------------------------
|
|
// On demande et recupere le token
|
|
// -----------------------------------------------------
|
|
$stripe = new \Stripe\StripeClient($privateSecretStripe);
|
|
|
|
// -----------------------------------------------------
|
|
// Annuler l'abo stripe
|
|
// -----------------------------------------------------
|
|
if (!empty($_SESSION['stripeSubscription_id'])) {
|
|
try {
|
|
$response= $stripe->subscriptions->cancel($_SESSION['stripeSubscription_id']);
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['Abonnement stripe annulé avec succès !' => ''], '');}
|
|
if (isset($debug[1]) && $debug[1] == '1' ) $debugMsg .=$response;
|
|
}catch(Exception $e) {
|
|
$api_error = $e->getMessage();
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['Cet abonnement stripe n' => $api_error, ' ID subscription' => $_SESSION['stripeSubscription_id']], '');}
|
|
}
|
|
}
|
|
if (isset($debug[2]) && $debug[2] == '1') { $debugMsg .= monDebug(2, ['Cet abonnement stripe n' => ''], '');}
|
|
?>
|