繁体   English   中英

使用PHP显示Braintree中的所有计划

[英]Show all plans in Braintree, using PHP

我在PHP应用程序中使用Braintree付款网关。 我正在创建要显示所有计划的订阅页面,以便客户可以订阅其中的任何计划。 我们如何使用PHP显示所有计划?

我使用了以下代码:

    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');
?>
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>");

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM