Created
August 18, 2016 02:51
-
-
Save govindak/31dbbfb84d7a24337a0a80fa25068755 to your computer and use it in GitHub Desktop.
Memberpress Create transaction programatically.
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
$sub = new MeprSubscription(); | |
$sub->user_id = $user_ID; | |
$sub->product_id = 123; | |
$sub->price = 12.99; | |
$sub->total = 12.99; | |
$sub->period = 1; | |
$sub->period_type = 'months'; | |
$sub->status = MeprSubscription::$active_str; | |
$sub_id = $sub->store(); | |
$txn = new MeprTransaction(); | |
$txn->amount = 12.99; | |
$txn->total = 12.99; | |
$txn->user_id = $user_ID; | |
$txn->product_id = 123; | |
$txn->status = MeprTransaction::$complete_str; | |
$txn->txn_type = MeprTransaction::$payment_str; | |
$txn->gateway = 'manual'; | |
$txn->expires_at = gmdate('Y-m-d 23:59:59', (time() + MeprUtils::months(1))); | |
$txn->subscription_id = $sub_id; | |
$txn->store(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment