使用Stripe Connect PHP添加外部银行帐户不起作用空白页

时间:2019-07-09 15:15:29

标签: javascript php stripe-payments connect

我有一个将数据发送到PHP页面的表单,该页面应将自定义银行帐户添加到Stripe帐户。

<?php
    require_once('vendor/autoload.php');
    \Stripe\Stripe::setApiKey('sk_live_secretkey');

    $fname = $POST['fname']; >> ect >>  

    $token = \Stripe\Token::create([
        "bank_account" => [
            "country" => $acc_cntry,
            "currency" => $acc_curr,
            "account_holder_name" => $acc_name,
            "account_holder_type" => $acc_type,
            "account_number" => $acc_num,
        ]
    ]);

    $legal_token = \Stripe\Token::create([
        "account" => [
            "legal_entity" => [
                "first_name" => $fname,
                "last_name" =>  $lname,
                "dob" => [
                    "day" => $dteob,
                    "month" => $mob,
                    "year" => $yob,
                ],
                "personal_address"   => [
                    "city" => $Apcity,
                    "country" => $Apcountry,
                    "line1" => $Apline1,
                    "line2" => "",
                    "postal_code" => $Appostal,
                    "state" => $Apstate,
                ],
                "business_name"=> $acc_name,
                "type" => $acc_type,
                "address" => [
                    "city" => $Bacity,
                    "country" => $acc_cntry,
                    "line1" => $Baline1,
                    "line2" => "",
                    "postal_code" => $Bapostal,
                    "state" => $Bastate,
                ],
            ],
            "tos_shown_and_accepted" => true,
        ]
    ]);

    $newacc = \Stripe\Account::create([
        "type" => "custom",
        "country" => $acc_cntry,
        "email" => $email,
        "default_currency" => $acc_curr,
        "external_account" => $token,
        "account_token" => $legal_token->id,
    ]);

    echo 'success: New Customer created in connect account. Account id: '.$newacc->id;
?>

按提交按钮时出现500错误。 有什么建议吗?

0 个答案:

没有答案