使用php在stripe中创建托管帐户时如何提供外部帐户参数? [英] How to provide external account parameter while creating managed account in stripe using php?

查看:20
本文介绍了使用php在stripe中创建托管帐户时如何提供外部帐户参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Stripe php 库.

I am using stripe php library.

这是我的代码:

$account = \Stripe\Account::create(
    array(
        "country" => "US",
        "managed" => true,
        "legal_entity" => array(
            'address' => array(
                'city' => 'Maxico',
                'country' => 'US',
                "line1" => 'H65',
                "line2" => 'standfort street',
                "postal_code" => '90046',
                "state" => 'CA'
            ),
            'business_name' => 'test business name',
            'business_tax_id' => '000000000',
            'dob' => array(
                'day' => '10',
                'month' => '01',
                'year' => '1988'
            ),
            'first_name' => 'Test',
            'last_name' => 'Tester',
            'personal_id_number' => '000000000',
            'ssn_last_4' => '0000',
            'type' => 'sole_prop'
        ),
        'tos_acceptance' => array(
            'date' => time(),
            'ip' => $_SERVER['REMOTE_ADDR']
        ),
        'external_account' => array(
            "country" => "US",
            "currency" => "usd",
            "account_holder_name" => 'Jane Austen',
            "account_holder_type" => 'individual',
            "routing_number" => "111000025",
            "account_number" => "000123456789"
        )
    )
);

这是我得到的错误:

external_account 哈希值必须包含一个对象"键,指示要创建的 external_account 的类型.

The external_account hash must include an 'object' key indicating what type of external_account to create.

任何建议将不胜感激.

推荐答案

使用 Stripe.js创建银行账户令牌客户端,然后在创建管理账户时使用此令牌.(这是推荐的方式.)

Use Stripe.js to create a bank account token client-side, then use this token when creating the managed account. (This is the recommended way.)

以下是使用 Stripe.js 创建银行帐户令牌的表单示例:https://jsfiddle.net/ywain/L2cefvtp/

Here's an example of a form using Stripe.js to create bank account tokens: https://jsfiddle.net/ywain/L2cefvtp/

你会像这样更新你的代码:

and you'd update your code like this:

        ...
        'external_account' => 'btok_...' // token returned by Stripe.js
    )

或者,您可以改为从服务器传递外部帐户信息.不建议这样做,因为它会增加应用程序的安全风险.在这种情况下,您必须包含 'object' =>'bank_account' 数组中的键/值对:

Alternatively, you can pass the external account information from your server instead. This is not recommended, as it increases the security risk of your application. In this case, you must include the 'object' => 'bank_account' key/value pair in the array:

        ...
        'external_account' => array(
            "object" => "bank_account",
            "country" => "US",
            "currency" => "usd",
            "account_holder_name" => 'Jane Austen',
            "account_holder_type" => 'individual',
            "routing_number" => "110000000",
            "account_number" => "000123456789"
        )
    )

这篇关于使用php在stripe中创建托管帐户时如何提供外部帐户参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆