transferwise / wise-php
Wise PHP 库
v0.2.1
2022-06-03 10:56 UTC
Requires
- php: >=5.6.0
- guzzlehttp/guzzle: >=6.3
Requires (Dev)
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2024-09-12 20:24:17 UTC
README
此库是为了适应wise API在php项目中的使用而编写的。使用wise,您可以自动化支付、连接您的商业工具,以及创建管理财务的方法。您还可以支持跨境和国内支付。更多信息请查看https://wise.com/和https://api-docs.wise.com/
要求
- PHP 5.6.0 及更高版本。
- cURL
安装
要安装此包,请使用composer命令
composer require transferwise/wise-php
示例代码
初始化客户端
$client = new \TransferWise\Client( [ "token" => "WISE_TOKEN", "profile_id" => "WISE_PROFILE_ID", "env" => "sandbox" // optional ] );
创建收款人账户
$client->recipient_accounts->create( [ "accountHolderName" => "John Snow", "currency" => "EUR", "type" => "iban", "details" => [ "legalType" => "PRIVATE", "IBAN" => "GBFSDFS546S5DF46S5" ] ] );
验证IBAN
$client->validators->iban($iban);
创建报价
$client->quotes->create( [ "sourceCurrency" => "EUR", "targetCurrency" => "GBP", "sourceAmount" => "100.00", "targetAmount" => null ] );
创建转账
$client->transfers->create( [ "targetAccount" => "account id", "quoteUuid" => "generated quote id", "customerTransactionId" => "transaction id", "details" => [ "reference" => "Company X", "transferPurpose"=> "verification.transfers.purpose.pay.bills", "sourceOfFunds"=> "verification.source.of.funds.other" ] ] );
资源
收款人账户
收款人是指您的支付最终受益人,可以是个人或机构。
可用方法
$client->recipient_accounts->create(); $client->recipient_accounts->all(); $client->recipient_accounts->retrieve(); $client->recipient_accounts->delete();
报价
报价资源定义了wise转账所需的基本信息——发送和接收的货币、金额以及汇款人。
可用方法
$client->quotes->create(); $client->quotes->temporary(); $client->quotes->update(); $client->quotes->retrieve();
转账
转账是根据报价对收款人账户的支付订单。一旦创建,转账需要在接下来的五个工作日内进行资金划拨。否则,它将自动取消。
可用方法
$client->transfers->create(); $client->transfers->requirements(); $client->transfers->fund(); $client->transfers->cancel(); $client->transfers->retrieve(); $client->transfers->issues(); $client->transfers->list();
验证器
使用此资源验证不同类型的银行详细信息,如IBAN、银行识别码、账号等。
可用方法
$client->validators->sortcode(); $client->validators->accountNo(); $client->validators->iban(); $client->validators->ibanandbic(); $client->validators->aba(); $client->validators->abaAccountNo(); $client->validators->ifsc(); $client->validators->banks(); $client->validators->branch();
个人资料
使用此资源管理wise用户个人资料。
可用方法
$client->profiles->create(); $client->profiles->update(); $client->profiles->all(); $client->profiles->retrieve(); $client->profiles->directors(); $client->profiles->addDirector(); $client->profiles->addIdentificationDocument();