2016-09-28 229 views
0

我试试这个代码不能创建管理条纹账户汇款到账号

Stripe::setApiKey("sk_test_eDpXMPqKt0zD1hr55Sw*****"); 
     Stripe::setApiVersion("2015-02-18"); 

     $account = Account::create([ 
      "country" => "US", 
      "managed" => true, 
      "email" => "gven****@gmail.com", 
     ]); 

     $account_ret = Account::retrieve($account->id); 

     $account_ret->support_phone = '555-666-7777'; 
     $account_ret->legal_entity->dob = [ 
      'day' => '10', 
      'month' => '01', 
      'year' => '1988' 
     ]; 

     $account_ret->legal_entity->address = [ 
      'city' => 'San Clemente', 
      'line1' => '100', 
      'line2'=>'Avenida Presidio', 
      'postal_code' => '92672', 
      'state' => 'CA', 
      'country' => 'US' 
     ]; 

     $account_ret->legal_entity->ssn_last_4 = '4242'; 
     $account_ret->legal_entity->first_name = "Gven"; 
     $account_ret->legal_entity->last_name = "Pzikyan"; 
     $account_ret->legal_entity->type = "individual"; 
     $account_ret->tos_acceptance = [ 
      'date' => time(), 
      'ip' => $_SERVER['REMOTE_ADDR'] 
     ]; 

     $account_ret->save(); 

我使用Laravel 5.1和条纹库PHP strype php

我收到此响应

{ 
    "status": "success", 
    "data": { 
    "id": "acct_18ygr2BKalvVkIRU", 
    "object": "account", 
    "bank_accounts": { 
     "object": "list", 
     "data": [], 
     "has_more": false, 
     "total_count": 0, 
     "url": "/v1/accounts/acct_18ygr2BKalvVkIRU/bank_accounts" 
    }, 
    "business_logo": null, 
    "business_name": null, 
    "business_url": null, 
    "charges_enabled": true, 
    "country": "US", 
    "debit_negative_balances": false, 
    "decline_charge_on": { 
     "avs_failure": false, 
     "cvc_failure": false 
    }, 
    "default_currency": "usd", 
    "details_submitted": false, 
    "display_name": null, 
    "email": "gven****@gmail.com", 
    "external_accounts": { 
     "object": "list", 
     "data": [], 
     "has_more": false, 
     "total_count": 0, 
     "url": "/v1/accounts/acct_18ygr2BKalvVkIRU/external_accounts" 
    }, 
    "legal_entity": { 
     "additional_owners": null, 
     "address": { 
     "city": "San Clemente", 
     "country": "US", 
     "line1": "100", 
     "line2": "Avenida Presidio", 
     "postal_code": "92672", 
     "state": "CA" 
     }, 
     "address_kana": { 
     "city": null, 
     "country": "US", 
     "line1": null, 
     "line2": null, 
     "postal_code": null, 
     "state": null, 
     "town": null 
     }, 
     "address_kanji": { 
     "city": null, 
     "country": "US", 
     "line1": null, 
     "line2": null, 
     "postal_code": null, 
     "state": null, 
     "town": null 
     }, 
     "business_name": null, 
     "business_name_kana": null, 
     "business_name_kanji": null, 
     "business_tax_id_provided": false, 
     "dob": { 
     "day": 10, 
     "month": 1, 
     "year": 1988 
     }, 
     "first_name": "Gven", 
     "first_name_kana": null, 
     "first_name_kanji": null, 
     "gender": null, 
     "last_name": "Pzikya", 
     "last_name_kana": null, 
     "last_name_kanji": null, 
     "maiden_name": null, 
     "personal_address": { 
     "city": null, 
     "country": "US", 
     "line1": null, 
     "line2": null, 
     "postal_code": null, 
     "state": null 
     }, 
     "personal_address_kana": { 
     "city": null, 
     "country": "US", 
     "line1": null, 
     "line2": null, 
     "postal_code": null, 
     "state": null, 
     "town": null 
     }, 
     "personal_address_kanji": { 
     "city": null, 
     "country": "US", 
     "line1": null, 
     "line2": null, 
     "postal_code": null, 
     "state": null, 
     "town": null 
     }, 
     "personal_id_number_provided": false, 
     "phone_number": null, 
     "ssn_last_4_provided": false, 
     "type": "individual", 
     "verification": { 
     "details": null, 
     "details_code": null, 
     "document": null, 
     "status": "unverified" 
     } 
    }, 
    "managed": true, 
    "metadata": [], 
    "product_description": null, 
    "statement_descriptor": null, 
    "support_email": null, 
    "support_phone": "555-666-7777", 
    "timezone": "Etc/UTC", 
    "tos_acceptance": { 
     "date": 1475064486, 
     "ip": "127.0.0.1", 
     "user_agent": "" 
    }, 
    "transfer_schedule": { 
     "delay_days": 2, 
     "interval": "daily" 
    }, 
    "transfers_enabled": false, 
    "verification": { 
     "disabled_reason": null, 
     "due_by": null, 
     "fields_needed": [ 
     "legal_entity.personal_id_number", 
     "bank_account" 
     ], 
     "contacted": false 
    }, 
    "currencies_supported": [ 
     "usd", 
     "aed", 
     "afn", 
     "all", 
     "amd", 
     "ang", 
     "aoa", 
     "ars", 
     "aud", 
     "awg", 
     "azn", 
     "bam", 
     "bbd", 
     "bdt", 
     "bgn", 
     "bif", 
     "bmd", 
     "bnd", 
     "bob", 
     "brl", 
     "bsd", 
     "bwp", 
     "bzd", 
     "cad", 
     "cdf", 
     "chf", 
     "clp", 
     "cny", 
     "cop", 
     "crc", 
     "cve", 
     "czk", 
     "djf", 
     "dkk", 
     "dop", 
     "dzd", 
     "egp", 
     "etb", 
     "eur", 
     "fjd", 
     "fkp", 
     "gbp", 
     "gel", 
     "gip", 
     "gmd", 
     "gnf", 
     "gtq", 
     "gyd", 
     "hkd", 
     "hnl", 
     "hrk", 
     "htg", 
     "huf", 
     "idr", 
     "ils", 
     "inr", 
     "isk", 
     "jmd", 
     "jpy", 
     "kes", 
     "kgs", 
     "khr", 
     "kmf", 
     "krw", 
     "kyd", 
     "kzt", 
     "lak", 
     "lbp", 
     "lkr", 
     "lrd", 
     "lsl", 
     "ltl", 
     "mad", 
     "mdl", 
     "mga", 
     "mkd", 
     "mnt", 
     "mop", 
     "mro", 
     "mur", 
     "mvr", 
     "mwk", 
     "mxn", 
     "myr", 
     "mzn", 
     "nad", 
     "ngn", 
     "nio", 
     "nok", 
     "npr", 
     "nzd", 
     "pab", 
     "pen", 
     "pgk", 
     "php", 
     "pkr", 
     "pln", 
     "pyg", 
     "qar", 
     "ron", 
     "rsd", 
     "rub", 
     "rwf", 
     "sar", 
     "sbd", 
     "scr", 
     "sek", 
     "sgd", 
     "shp", 
     "sll", 
     "sos", 
     "srd", 
     "std", 
     "svc", 
     "szl", 
     "thb", 
     "tjs", 
     "top", 
     "try", 
     "ttd", 
     "twd", 
     "tzs", 
     "uah", 
     "ugx", 
     "uyu", 
     "uzs", 
     "vnd", 
     "vuv", 
     "wst", 
     "xaf", 
     "xcd", 
     "xof", 
     "xpf", 
     "yer", 
     "zar", 
     "zmw" 
    ] 
    } 
} 
  1. bank_account在响应中表示什么?
  2. 有任何要求我可以遵循的例子吗?

回答

1

好问题!当您在“fields_needed”下看到“bank_account”时,这意味着管理帐户没有附加银行帐户信息。为了完成验证帐户,则必须通过“更新帐户” API调用来提交帐户信息:

https://stripe.com/docs/api/curl#update_account-external_account

在API“BANK_ACCOUNT”的最新版本被称为“external_account”,见这里的注意: https://stripe.com/docs/upgrades#2015-10-01

它看起来像你的条纹帐户是前段时间创建的,所以它的API版本不是最新的。如果您仍在处理您的解决方案,我会考虑升级您的API版本。 API文档仅涵盖最新的API版本,因此如果您使用的是旧版本,则可能会发现一些差异。一定要通过升级说明如下: /文档/升级

你可以从这里仪表板升级您的API版本: /帐号/ apikeys

。希望清除的东西了!如果您有任何其他问题,请告诉我,我很乐意提供帮助。

将下列行添加到您的请求中。这将解决您的问题。

$account_ret->legal_entity->business_name = 'test_business_name '; 
    $account_ret->legal_entity->business_tax_id = '000000000'; 
    $account_ret->legal_entity->type = "sole_prop"; 
    $account_ret->external_account = array(
     "object" => "bank_account", 
     "country" => "US", 
     "currency" => "usd", 
     "account_holder_name" => 'Gven Pzikyan', 
     "account_holder_type" => 'individual', 
     "routing_number" => "110000000", 
     "account_number" => "00" 
    ); 
    $file = FileUpload::create([ 
     "purpose" => "identity_document", 
     "file" => fopen('/path/to/file/file.jpeg', 'r') 
    ], 
    [ 
     "stripe_account" => $account->id 
    ]); 

    $account_ret->legal_entity->verification->document = $file->id; 

    $account_ret->save(); 
+1

感谢它为我工作! –