Reputation: 455
I am using Braintree payment gateway in my PHP application. I am creating subscription page on which I want to show all plans, so that the customer can subscribe any of them. How can we show all plans using PHP?
I have used the following code:
require_once ("../braintree/_environment.php");
$plans = Braintree_Plan::all();
print_r($plans);
but it shows nothing. I already have created a plan in my braintree account.
Following is the code for _environment.php file
<?php
require_once('braintree-php/lib/Braintree.php');
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('merchantkey');
Braintree_Configuration::publicKey('publickey');
Braintree_Configuration::privateKey('privatekey');
?>
Upvotes: 0
Views: 763
Reputation: 25
print_r("<pre>");
$plans = Braintree_Plan::all();
foreach ($plans AS $plan) {
print_r("<br>PLAN");
print_r("<br> id = " . $plan->id);
print_r("<br> name = " . $plan->name);
print_r("<br> description = " . $plan->description);
print_r("<br> price = " . $plan->price);
print_r("<br> currency = " . $plan->currency);
print_r("<br> trialPeriod = " . $plan->trialPeriod);
print_r("<br> billingDayOfMonth = " . $plan->billingDayOfMonth);
print_r("<br> numberOfBillingCycles = " . $plan->numberOfBillingCycles);
// print_r("<br> billingCycle = " . $plan->billingCycle);
}
print_r("</pre>");
Upvotes: 0