I am using stripe php library.
Here is my code:
$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"
)
)
);
This is the error I am getting:
The external_account hash must include an 'object' key indicating what type of external_account to create.
Any suggestion will be appreciated.
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.)
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
)
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"
)
)
You have to add stripe library first & then user the key to make object
require_once(APPPATH.'libraries/stripe/init.php');
\Stripe\Stripe::setApiKey($this->privateKey);
Like this then you can create customer on stripe.
Here is library link.
You can do something like this, creating a token client side (with the Android SDK, iOS or StripeJS) then in your server side you pass the token to the external account
var stripe = require("stripe")("sk_test_c7VExQZarF76Mm59HTcD7NLo");
stripe.accounts.createExternalAccount(
"acct_1DO7wfJyhqKlvfeX",
{ external_account: "btok_1DZipAJyhqKlvfeXSA5OATY1" },
function(err, bank_account) {
// asynchronously called
}
);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.