从管理员到关联账户的资金转账

时间:2016-09-30 18:27:36

标签: php stripe-connect

我正在开发php中的Stripe集成。

场景是:客户向管理员的条带帐户付款,并且在几天之后,管理员想要向其他关联帐户付款。

到目前为止,我所做的是:

  1. 客户付款工作正常。
  2. 创建了已连接的帐户。
  3. 已验证已连接帐户。

    \条纹\条纹:: setApiKey( 'sk_test_rdCVucE0VS6dK729JQx3UeAJ');

     \Stripe\Account::create(
        array(
            "country" => "US",
            "managed" => true,
    
            "external_account" => array(
                "object" => "card",
                "country" => "US",
                "currency" => "usd",
                "number" => "4000000000000077",
                ),
            )
        );
    
    /*------------------------------Update User------------------*/
    $account = \Stripe\Account::retrieve('acct_18zEaLF4JdCk8535');
    $account->legal_entity->first_name = "raghvendra";
    $account->legal_entity->last_name = "Singh";
    $account->legal_entity->dob->day = 22;
    $account->legal_entity->dob->month = 8;
    $account->legal_entity->dob->year = 1994;
    $account->legal_entity->type = 'individual';
    $account->tos_acceptance->date = time();
    $account->tos_acceptance->ip = $_SERVER['REMOTE_ADDR'];
    $account->legal_entity->ssn_last_4 = '8547';
    $account->legal_entity->address->line1 = 'aa';
    $account->legal_entity->address->city= 'bb';
    $account->legal_entity->address->postal_code = '12345';
    $account->legal_entity->address->state = 'st';
    $account->legal_entity->personal_id_number='123458547';
    
    $account->legal_entity->additional_owners = array(
        array('first_name' => 'Bob', 'last_name' => 'Smith'),
        array('first_name' => 'Jane', 'last_name' => 'Doe')
        );
    
    $count = count($account->legal_entity->additional_owners);
    $account->legal_entity->additional_owners[$count] = array(
        'first_name' => 'Andrew',
        'last_name' => 'Jackson'
        );
    
    $account->legal_entity->additional_owners = null;
    
    /*------------------------------Verify user-----------------------------*/
    
    $file = \Stripe\FileUpload::create(
        array(
            "purpose" => "identity_document",
            "file" => fopen(public_path().'/img/1.jpg', 'r')
            ),
        array("stripe_account" => 'acct_18zEaLF4JdCk8535')
        );
    $img_id = $file->id;
    $account = \Stripe\Account::retrieve('acct_18zEaLF4JdCk8535');
    $account->legal_entity->verification->document = $img_id;
    $account->save();
    

    }

  4. 立即 假设管理员帐户中有100美元,管理员希望将50美元转移到他的帐户中。

    对于转账基金,我正在使用

    \Stripe\Stripe::setApiKey('sk_test_rdCVucE0VS6dK729JQx3UeAJ');
    
    \Stripe\Transfer::create(array(
        "amount" => 400,
        "currency" => "usd",
        "destination" => "acct_18zEaLF4JdCk8535",
        "description" => "Transfer for test@example.com"
        ));
    

    这可能吗?请帮帮我

1 个答案:

答案 0 :(得分:0)

`\Stripe\Stripe::setApiKey('sk_test_rdCVucE0VS6dK729JQx3UeAJ');`

`\Stripe\Transfer::create(array(
    "amount" => 400,
    "currency" => "usd",
    "destination" => "acct_18zEaLF4JdCk8535",
    "description" => "Transfer for test@example.com"
    ));
`
After above process u get a amount in your stripe external account. 
Now u want transfer it in your bank account 
So use a payout for that like below.

`$data = ["amount" => 400, "currency" => 'USD'];
\Stripe\Payout::create($data, ["stripe_account" => acct_18zEaLF4JdCk8535];`

Now its done