Last active
November 19, 2019 01:06
-
-
Save nishapanFFF/47efa87588b715252851016168ba311e to your computer and use it in GitHub Desktop.
This file contains 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
require_once APPPATH . 'third_party/Recurly215/recurly.php'; // using recurly 2.15 client lib | |
$subscription = new Recurly_Subscription(); | |
$subscription->plan_code = 'access_trial'; | |
// .. fill in more subscription info | |
$account = new Recurly_Account(); | |
$account->account_code = 'npstagingac1118_1@yopmail.com'; | |
// .. fill in more account info | |
$subscription->account = $account; | |
$subscription->create(); | |
if ($subscription) { | |
// change access_trial plan type to fffvip on renewal | |
$subscription->plan_code = 'fffvip'; | |
$subscription->quantity = 1; | |
// addons | |
$addon = new Recurly_SubscriptionAddOn(); | |
$addon->add_on_code = 'hi'; | |
$addon->unit_amount_in_cents = 100; | |
$addon->quantity = 1; | |
$addons = array(); | |
$addons[] = $addon; | |
$subscription->subscription_add_ons = $addons; | |
// we believe the error is thrown from the following call. | |
// i'm not able to confirm because we have a try/catch surrounding | |
// the entire block of code so it's possible that the error came from another request. | |
$subscription->updateAtRenewal(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment