Unsubscribe at end of period

Question:

How to add the "at_period_end" argument to the next PHP function according to the relevant Stripe documentation?

DOCUMENTATION:

STRIPE: Unsubscribe

CODE:

<?php require_once('./lib/Stripe.php'); Stripe::setApiKey("$APIKEY"); $cu = Stripe_Customer::retrieve("$CUSTOMER_ID"); $cu->subscriptions->retrieve("$SUBSCRIPTION_ID")->cancel(); ?> 
+5
source share
2 answers

I found the correct solution:

 $cu->subscriptions->retrieve("$SUBSCRIPTION_ID")->cancel( array("at_period_end" => true )); 
+11
source

Try specifying the argument as an array like this:

 $at_period_end = true; $cu->subscriptions->retrieve("$SUBSCRIPTION_ID")->cancel( array("at_period_end" => $at_period_end)); 
+5
source

Source: https://habr.com/ru/post/1202214/


All Articles