向芒果用户添加银行帐户时出现MangoPay错误

时间:2016-11-19 09:21:29

标签: payment

我正在使用MangoPay php sdk为芒果支付用户创建一个银行账户,这里是代码

$api = new \MangoPay\MangoPayApi();     
$api->Config->ClientId = 'clientid';
$api->Config->ClientPassword = 'password';
$api->Config->TemporaryFolder = 'temp/mango/';
$mango_user_id = '1234567';

$bank_account = new \MangoPay\BankAccount();
$details = new \MangoPay\BankAccountDetailsIBAN();
$details->IBAN = 'ibanbannkaccountnumber';
$details->BIC  = 'CRLYFRPP';

$bank_account->OwnerName = 'Joe Blogs'; 
$bank_account->Details = $details;
$created_account = $api->Users->CreateBankAccount($mango_user_id,$bank_account);

并收到此错误消息:

RestTool.php第345行中的ResponseException: 错误的请求。一个或多个必需参数缺失或不正确。不正确的资源ID也会引发此类错误。

1 个答案:

答案 0 :(得分:1)

https://docs.mangopay.com/endpoints/v2.01/bank-accounts#e41_create-an-iban-bankaccount

需要OwnerAddress

$bank_account->OwnerAddress = new \MangoPay\Address();
$bank_account->OwnerAddress->AddressLine1 = 'addressLine1';
$bank_account->OwnerAddress->City = 'city';
$bank_account->OwnerAddress->PostalCode = 'PostalCode';
$bank_account->OwnerAddress->Country = 'CountryIsoCode';