PHP:通过Stripe Connect API添加external_account?

时间:2017-08-13 09:37:44

标签: php

我正在尝试通过PHP API将external_account添加到条带连接帐户。

我发现了这个:

How to provide external account parameter while creating managed account in stripe using php?

所以我继续编写了我自己的代码:

$acct = \Stripe\Account::create(array(
        "country" => "GB",
        "type" => "custom",
        "email" => "email@mail.com"
        'external_account' => array(
            "country" => "US",
            "currency" => "usd",
            "account_holder_name" => 'Jane Austen',
            "account_holder_type" => 'individual',
            "routing_number" => "111000025",
            "account_number" => "000123456789"
        )
    ));

但是当我运行该代码时,我收到以下错误:

[Sun Aug 13 05:30:21 2017] [warn] [client 82.43.186.69] mod_fcgid: stderr: PHP Parse error:  syntax error, unexpected ''external_account'' (T_CONSTANT_ENCAPSED_STRING), expecting ')' in /index.php on line 30

第30行就是这样:

'external_account' => array(

有人可以就此问题提出建议吗?

1 个答案:

答案 0 :(得分:1)

在这种情况下,在字段" email"之后,它是一个简单的遗漏,

$acct = \Stripe\Account::create(array(
      "country" => "GB",
      "type" => "custom",
      "email" => "email@mail.com"   // <--- missing ','
      'external_account' => array(
          "country" => "US",
          "currency" => "usd",
          "account_holder_name" => 'Jane Austen',
          "account_holder_type" => 'individual',
           "routing_number" => "111000025",
           "account_number" => "000123456789"
       )
   ));

添加后,错误就会消失。