Skip to content

Commit 40a5072

Browse files
Merge pull request #20 from PaystackOSS/new_user_activation
fix: fixed the error of user not being able to cancel a subscription.
2 parents 7eadd4a + 07560af commit 40a5072

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

MeprPaystackGateway.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -818,14 +818,19 @@ public function process_cancel_subscription($sub_id)
818818
{
819819
$sub = new MeprSubscription($sub_id);
820820

821+
//Getting the value of the paystack_email_token from the array and storing the value in a variable
822+
$array = $sub->get_meta('paystack_email_token');
823+
$token = $array[0];
824+
825+
821826
if (!isset($sub->id) || (int) $sub->id <= 0)
822827
throw new MeprGatewayException(__('This subscription is invalid.', 'memberpress'));
823828

824829
$args = MeprHooks::apply_filters('mepr_paystack_cancel_subscription_args', array(
825830
'code' => $sub->subscr_id,
826-
'token' => $sub->get_meta('paystack_email_token'),
831+
'token' => $token,
827832
), $sub);
828-
833+
829834
// Yeah ... we're cancelling here bro ... but this time we don't want to restart again
830835
$res = $this->paystack_api->send_request("subscription/disable", $args);
831836

0 commit comments

Comments
 (0)