Updating Stripe plan customer number in PHP / CodeIgniter -
this first time interacting stripe , trying tie codeigniter. currently, when create account on application adds correct stripe plan , increases total amount billed on account.
i'm having problem trying work subscription plan #. found in documentation deals subscription plans quantity.
what need happen when deactivate user, needs update quantity 1 less. can't figure out.
playing around api able delete subscribed customer doing:
$this->load->library( 'stripe' ); $this->stripe->customer_delete('cus_1ws0pth6srnf7h'); now i'm working with:
$this->load->library( 'stripe' ); $customer_id = $company->stripe_id; $this->stripe->customer_update($customer_id, **what goes here?**); any appreciated. sum up, need update quantity of plan -1 when user deactivated. user being deactivated fine in application, need send request stripe update plan 1 less user.
perhaps customer_update function isn't right 1 use this? there lot in stripe.php file.
once have solved can handle applying reactivating user.
here documentation think need be
not clear if using library or not, should check:
https://github.com/bcessa/php-stripe
written ci & simple. i'm going assume are.
according stripe support (i did exact same thing recently), need make unsubscribe & resubscribe new plan.
the steps want through, roughly, were:
1) next invoice - capture next billing date new subscription (we used trial period, needed this. might able skip)
2) unsubscribe customer
3) new total user count
4) create plan id (can same had before, believe)
5) subscribe new count new plan
6) update on own db
Comments
Post a Comment