Shibbir
Shibbir

Reputation: 2041

Stripe: Missing required param: type

I am creating a bank account using PHP stripe API.

To do that I am using following PHP code:

$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,
    )
);

Now, after fill up the all form data it's showing me an error message.

Error message:

Missing required param: type.

I don't understand where I missed type param?

Upvotes: 0

Views: 7120

Answers (2)

Nur Zico
Nur Zico

Reputation: 2447

You have missed type field which is required. You have a type field in legal_entity object. It should not be in legal_entity. It should be in root array of parameter. Detail are here

Upvotes: 1

Exprator
Exprator

Reputation: 27533

<?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,
    )
);

Upvotes: 1

Related Questions