How to provide an external account setting when creating a managed account in strip using php?

I am using the 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 get:

The external_account key must include the object key, which indicates what type of external_ combination should be created.

Any suggestion would be appreciated.

+4
source share
2 answers

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

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"
        )
    )
+9

stripe,

require_once(APPPATH.'libraries/stripe/init.php');

\Stripe\Stripe::setApiKey($this->privateKey);

, .

.

+1

All Articles