条纹:缺少必需的参数:类型

时间:2017-05-28 06:58:24

标签: php stripe-payments

我正在使用PHP条带API创建一个银行帐户。

为此,我使用以下PHP代码:

$createBankAcc = \Stripe\Account::create(
    array(        
        "country" => "US", 
        "managed" => true,
        "email" => $email_db,
        "legal_entity" => array(
            'address' => array(
                'city' => $city,  
                'country' => 'US',
                "line1" => $address1,
                //"line2" => $address2,
                "postal_code" => $zip,
                "state" => $state,
            ),
            'business_name' => '',
            'business_tax_id' => '',
            'dob' => array(
                'day' => $day,
                'month' => $month,
                'year' => $year,
            ),
            'first_name' => $fname_db,
            'last_name' =>  $lname_db,
            'personal_id_number' => $pin,                           
            'ssn_last_4' => $ssn,
            'type' => 'individual',                             
        ),
        'tos_acceptance' => array(
            'date' => time(),
            'ip' => $_SERVER['REMOTE_ADDR']
        ),
        'transfer_schedule' => array(
            "interval" => 'weekly', 
            "weekly_anchor" => 'sunday'
        ),
        'external_account' => $stripeToken,
    )
);

现在,在填写完所有表单数据后,它会显示错误消息。

错误讯息:

Missing required param: type.

我不明白我错过了类型 param?

2 个答案:

答案 0 :(得分:1)

<?php
$createBankAcc = \Stripe\Account::create(
    array(
        "country" => "US",
        "managed" => true,
        "email" => $email_db,
        "legal_entity" => array(
            'address' => array(
                'city' => $city,
                'country' => 'US',
                "line1" => $address1,
                //"line2" => $address2,
                "postal_code" => $zip,
                "state" => $state,
            ),
            'business_name' => '',
            'business_tax_id' => '',
            'dob' => array(
                'day' => $day,
                'month' => $month,
                'year' => $year,
            ),
            'first_name' => $fname_db,
            'last_name' => $lname_db,
            'personal_id_number' => $pin,
            'ssn_last_4' => $ssn,

        ),
        'type' => 'individual',
        'tos_acceptance' => array(
            'date' => time(),
            'ip' => $_SERVER['REMOTE_ADDR']
        ),
        'transfer_schedule' => array(
            "interval" => 'weekly',
            "weekly_anchor" => 'sunday'
        ),
        'external_account' => $stripeToken,
    )
);

答案 1 :(得分:0)

您错过了type字段,这是必需的。您在type对象中有一个legal_entity字段。  它不应该在legal_entity中。它应该在参数的根数组中。 细节为here