Search code examples
phplaravellaravel-5braintreelaravel-cashier

Laravel Cashier Braintree cancel subscription graceperiod


I am using laravel cashier to create a subscription based plan purchasing system with Braintree as a payment gateway.

My subscriptions are successfully created, my issue is when canceling.

After I fire:

$user->subscription('pro')->cancel();

The user is successfully transitioned into the grace period where a user has days remaining before his plan actually expires, but on Braintree the subscription is still active and not canceled.

However when I fire:

$user->subscription('pro')->cancelNow();

The subscription on Braintree is now marked as Canceled.

My question is how will Braintree know not to charge this user if cashier does not mark the subscription in Braintree as canceled.

Maybe I'm missing something here... Do I need to handle this myself when canceling subscriptions using the Briantree PHP SDK. If anyone has had this question before and found a solution, your opinions would be greatly appreciated.


Solution

  • Ok, actually managed to figure this out.

    Firing the:

    $user->subscription('pro')->cancel();
    

    What the cancel() method actually does is set your subscription on Braintree to end after 1 billing cycle in term canceling the Braintree subscription on the next billing date. To verify this what you need to do is. Find the subscription from the Braintree dashboard and 'edit' the subscription and there you will find that the billing cycle will be set to end after 1 cycle.

    Calling the method:

    $user->subscription('pro')->resume();
    

    On a user in the grace period will set the subscription's end after period too Never