使用PHP在Braintree中显示所有计划
我在PHP应用程序中使用Braintree支付网关。我正在创建订阅页面,我希望在其中显示所有计划,以便客户可以订阅其中任何一个计划。如何使用PHP显示所有计划 我使用了以下代码:使用PHP在Braintree中显示所有计划,php,braintree,Php,Braintree,我在PHP应用程序中使用Braintree支付网关。我正在创建订阅页面,我希望在其中显示所有计划,以便客户可以订阅其中任何一个计划。如何使用PHP显示所有计划 我使用了以下代码: require_once ("../braintree/_environment.php"); $plans = Braintree_Plan::all(); print_r($plans); 但它什么也没表现出来。我已经在我的braintree帐户中创建了一个计划 以下是_environme
require_once ("../braintree/_environment.php");
$plans = Braintree_Plan::all();
print_r($plans);
但它什么也没表现出来。我已经在我的braintree帐户中创建了一个计划
以下是_environment.php文件的代码
<?php
require_once('braintree-php/lib/Braintree.php');
Braintree_Configuration::environment('sandbox');
Braintree_Configuration::merchantId('merchantkey');
Braintree_Configuration::publicKey('publickey');
Braintree_Configuration::privateKey('privatekey');
?>
打印(“”);
$plans=Braintree_Plan::all();
foreach($计划作为$计划){
打印(“平面图”);
打印(“
id=”.$plan->id);
打印(“
name=“.$plan->name”);
打印(“
description=“.$plan->description”);
打印(“
price=”.$plan->price);
打印(“
currency=“.$plan->currency”);
打印(“
trialPeriod=“.$plan->trialPeriod”);
打印(“
billingDayOfMonth=“.plan->billingDayOfMonth”);
打印(“
numberOfBillingCycles=“.plan->numberOfBillingCycles”);
//打印(“
billingCycle=“.plan->billingCycle”);
}
印刷品(“”);
我已经将environment.php包含在私有、公共和商户密钥中。下面是_environment.php文件的代码:我在问题中展示了_environment.php文件代码。
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>");