Last active
July 16, 2016 04:04
-
-
Save ibrahimlawal/4a76070866d5a54036e992609078f981 to your computer and use it in GitHub Desktop.
Enable or disable Paystack subscriptions in PHP, knowing the token and code // Uses Paystack Class : https://github.com/yabacon/paystack-class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get this from https://github.com/yabacon/paystack-class | |
require 'Paystack.php'; | |
$paystack = new Paystack('sk_test_xxx'); | |
// ... some code previously to obtain $token and $code for this subscription | |
// (both can be obtained by capturing `subscription.create` event) | |
// the code below throws an exception if there was a problem completing the request, | |
// else returns an object created from the json response | |
$subscription_credentials = [ | |
'token' => $token, | |
'code' => $code, | |
]; | |
$trx = $paystack->subscription->disable($subscription_credentials); | |
// status should be true if there was a successful call | |
if($trx->status){ | |
// disabled successfully | |
echo($trx->message); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Get this from https://github.com/yabacon/paystack-class | |
require 'Paystack.php'; | |
$paystack = new Paystack('sk_test_xxx'); | |
// ... some code previously to obtain $token and $code for this subscription | |
// (both can be obtained by capturing `subscription.create` event) | |
// the code below throws an exception if there was a problem completing the request, | |
// else returns an object created from the json response | |
$subscription_credentials = [ | |
'token' => $token, | |
'code' => $code, | |
]; | |
$trx = $paystack->subscription->enable($subscription_credentials); | |
// status should be true if there was a successful call | |
if($trx->status){ | |
// enabled successfully | |
echo($trx->message); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment