我正在使用条纹php库。
这是我的代码:
$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哈希必须包含一个'object'键,指示要创建的external_account的类型。
任何建议都将受到赞赏。
答案 0 :(得分:13)
使用Stripe.js创建bank account token客户端,然后在创建客户帐户时使用此令牌。 (这是推荐的方式。)
以下是使用Stripe.js创建银行帐户令牌的表单示例:https://jsfiddle.net/ywain/L2cefvtp/
您可以像这样更新代码:
...
'external_account' => 'btok_...' // token returned by Stripe.js
)
或者,您可以从服务器传递外部帐户信息。 不建议这样做,因为这会增加应用程序的安全风险。在这种情况下,您必须在数组中包含'object' => 'bank_account'
键/值对:
...
'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"
)
)
答案 1 :(得分:1)
您必须首先添加条带库&然后使用键来制作对象
require_once(APPPATH.'libraries/stripe/init.php');
\Stripe\Stripe::setApiKey($this->privateKey);
就像这样,您可以在条带上创建客户。
Here是图书馆链接。
答案 2 :(得分:0)
您可以执行以下操作,创建令牌客户端(使用Android SDK,iOS或StripeJS),然后在服务器端将令牌传递给外部帐户
var stripe = require("stripe")("sk_test_c7VExQZarF76Mm59HTcD7NLo");
stripe.accounts.createExternalAccount(
"acct_1DO7wfJyhqKlvfeX",
{ external_account: "btok_1DZipAJyhqKlvfeXSA5OATY1" },
function(err, bank_account) {
// asynchronously called
}
);