【问题标题】:Stripe: Missing required param: type条纹:缺少必需的参数:类型
【发布时间】:2017-10-28 16:59:55
【问题描述】:

我正在使用 PHP Stripe 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.

我不明白我在哪里错过了 type 参数?

【问题讨论】:

    标签: php stripe-payments


    【解决方案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,
        )
    );
    

    【讨论】:

      【解决方案2】:

      您错过了必填字段type。您在 legal_entity 对象中有一个 type 字段。 它不应该在legal_entity 中。它应该在参数的根数组中。 详情here

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-11-05
        • 2018-10-28
        • 2018-12-01
        • 2016-06-29
        • 2018-06-20
        • 2020-09-27
        • 1970-01-01
        相关资源
        最近更新 更多