bitpesa / bitpesa-php-sdk
TransferZero 客户端库,适用于PHP
1.36.4
2024-08-22 12:58 UTC
Requires
- php: >=7.2
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ~2.12
- phpunit/phpunit: ^7.4
- squizlabs/php_codesniffer: ~2.6
- dev-master
- 1.36.4
- 1.36.3
- 1.36.0
- 1.35.1
- 1.35.0
- 1.34.2
- 1.34.1
- 1.34.0
- 1.33.1
- 1.33.0
- 1.32.0
- 1.31.0
- 1.30.3
- 1.30.2
- 1.30.1
- 1.30.0
- 1.29.0
- 1.28.2
- 1.28.1
- 1.28.0
- 1.27.9
- 1.27.8
- 1.27.5
- 1.27.3
- 1.27.0
- 1.26.1
- 1.25.0
- 1.24.0
- 1.23.5
- 1.23.4
- 1.23.3
- 1.23.0
- 1.22.1
- 1.22.0
- 1.21.0
- 1.20.0
- 1.19.4
- 1.19.3
- 1.19.2
- 1.19.1
- 1.19.0
- 1.18.0
- 1.17.0
- 1.16.1
- 1.16.0
- 1.15.1
- 1.15.0
- 1.14.1
- 1.14.0
- 1.13.0
- 1.12.2
- 1.12.0
- 1.11.0
- 1.10.0
- 1.9.0
- 1.8.0
- 1.7.0
- 1.6.0
- 1.5.1
- 1.5.0
- 1.4.0
- 1.3.0
- 1.2.0
- 1.0.0
- dev-BTA-14095-add-api-examples
- dev-check-upgrade-guzzle
- dev-upgrade-Guzzle
- dev-BTA-10785-revert-codebuild-changes
- dev-upgrade-to-use-x-group-params
- dev-production
- dev-staging
- dev-BTA-2022-re-release-transferzero-php-sdk
This package is not auto-updated.
Last update: 2024-09-23 17:52:57 UTC
README
这是用于与TransferZero API一起使用的PHP客户端库。要使用API,请注册并在TransferZero开发者门户上获取有效的API密钥。
更多信息,请访问
此PHP包由OpenAPI Generator项目自动生成
- API版本:1.0
- 包版本:1.36.4
要求
PHP 7.1及更高版本
安装与使用
Composer
要通过Composer安装,请运行
composer require transferzero/transferzero-php-sdk
然后运行 composer install
是Composer新手?在Composer入门页面了解更多
手动安装
下载文件并包含 autoload.php
require_once('/path/to/TransferZeroSdk/vendor/autoload.php');
入门
请遵循安装程序,然后运行以下操作
<?php require_once(__DIR__ . '/vendor/autoload.php');
身份验证
在配置对象上设置API密钥和密钥,以进行身份验证
TransferZero\Configuration::getDefaultConfiguration() ->setHost("https://api-sandbox.transferzero.com/v1") ->setApiKey("<key>") ->setApiSecret("<secret>");
示例
$apiInstance = new TransferZero\Api\APILogsApi(); $api_log_id = 'api_log_id_example'; // string | ID of the API log to retrieve Example: `/v1/api_logs/00485ce9-532b-45e7-8518-7e5582242407` try { $result = $apiInstance->getApiLog($api_log_id); print_r($result); } catch (Exception $e) { if ($e->isValidationError()) { $response = $e->getResponseObject(); echo "Validation error(s) occurred when calling the endpoint"; print_r($response); } else { echo "An exception occurred when calling APILogsApi#getApiLog"; echo $e->getMessage(); } } ?>
您可以在入职文档中的examples
目录中找到更多示例
Webhooks
要解析webhooks,可以使用以下片段
$webhook_content = "{ (...) }"; // The string received through the webhook callback url $webhook_headers = [ "Authorization-Nonce" => "<authorization-nonce>", "Authorization-Key" => "<authorization-key>", "Authorization-Signature" => "<authorization-signature>" ]; // The headers from the webook callback url $webhook_url = "<url>"; // The url of the webhook callback $webhooksApi = new TransferZero\Api\WebhooksApi(); if (!$webhooksApi->validateWebhookRequest($webhook_url, $webhook_content, $webhook_headers)) { echo "Webhook request validation failed"; return false; } $webhook = $webhooksApi->parseResponseString($webhook_content, 'Webhook'); if (strpos($webhook->getEvent(), 'transaction') === 0) { $transactionWebhook = $webhooksApi->parseResponseString($webhook_content, 'TransactionWebhook'); print_r($transactionWebhook->getObject()->__toString()); } elseif (strpos($webhook->getEvent(), 'recipient') === 0) { $recipientWebhook = $webhooksApi->parseResponseString($webhook_content, 'RecipientWebhook'); print_r($recipientWebhook->getObject()->__toString()); } elseif (strpos($webhook->getEvent(), 'payout_method') === 0) { $payoutMethodWebhook = $webhooksApi->parseResponseString($webhook_content, 'PayoutMethodWebhook'); print_r($payoutMethodWebhook->getObject()->__toString()); } elseif (strpos($webhook->getEvent(), 'sender') === 0) { $senderWebhook = $webhooksApi->parseResponseString($webhook_content, 'SenderWebhook'); print_r($senderWebhook->getObject()->__toString()); } elseif (strpos($webhook->getEvent(), 'document') === 0) { $documentWebhook = $webhooksApi->parseResponseString($webhook_content, 'DocumentWebhook'); print_r($documentWebhook->getObject()->__toString()); }
API端点文档
所有URI均相对于https://api-sandbox.transferzero.com/v1
模型文档
- 账户
- AccountListResponse
- AccountMeta
- AccountResponse
- AccountValidationError
- AccountValidationRequest
- AccountValidationResponse
- AccountValidationResult
- ApiLog
- ApiLogListResponse
- ApiLogResponse
- 货币
- CurrencyExchange
- CurrencyExchangeListResponse
- CurrencyListResponse
- CurrencyOpposite
- 借记
- DebitListRequest
- DebitListResponse
- DebitRequest
- DebitRequestWrapper
- 文件
- DocumentListResponse
- DocumentRequest
- DocumentResponse
- DocumentWebhook
- ErrorStatus
- FieldDescription
- FieldSelectValidation
- FieldValidation
- 分页
- PaginationMeta
- 支付方式
- PayinMethodDetails
- PayinMethodDetailsBTC
- PayinMethodDetailsMobile
- PayinMethodDetailsNGNBank
- PayinMethodRequest
- PayinMethodResponse
- PayinMethodState
- PayinMethodUxFlow
- PaymentMethod
- PaymentMethodListResponse
- PaymentMethodOpposite
- 支付方式
- PayoutMethodBankAccountTypeEnum
- PayoutMethodCashProviderEnum
- PayoutMethodCountryEnum
- PayoutMethodDetails
- PayoutMethodDetailsBRLBank
- PayoutMethodDetailsBTC
- PayoutMethodDetailsBWPBank
- PayoutMethodDetailsBalance
- PayoutMethodDetailsCADBank
- PayoutMethodDetailsEGPBank
- PayoutMethodDetailsEGPCash
- PayoutMethodDetailsGBPBank
- PayoutMethodDetailsGHSBank
- PayoutMethodDetailsGHSCash
- PayoutMethodDetailsGNFMobile
- PayoutMethodDetailsIBAN
- PayoutMethodDetailsINRBank
- PayoutMethodDetailsKESBank
- PayoutMethodDetailsKESMobile
- PayoutMethodDetailsMADCash
- PayoutMethodDetailsMobile
- PayoutMethodDetailsNGNBank
- PayoutMethodDetailsNZDBank
- PayoutMethodDetailsUGXBank
- PayoutMethodDetailsUSDBank
- PayoutMethodDetailsUSDCash
- PayoutMethodDetailsXAFBank
- PayoutMethodDetailsXAFMobile
- PayoutMethodDetailsXOFBank
- PayoutMethodDetailsXOFCash
- 支付方式详情XOFMobile
- 支付方式详情ZARBank
- 支付方式详情ZMWBank
- 支付方式性别枚举
- 支付方式身份证类型枚举
- 支付方式法人实体类型枚举
- 支付方式列表响应
- 支付方式移动运营商枚举
- 支付方式业务性质枚举
- 支付方式Pix密钥类型枚举
- 支付方式请求
- 支付方式响应
- 支付方式转账原因枚举
- 支付方式Webhook
- 政治敏感人物
- 支付证明
- 支付证明列表响应
- 收款人
- 收款人列表响应
- 收款人请求
- 收款人响应
- 收款人状态
- 收款人状态原因详情
- 收款人Webhook
- 发送人
- 发送人列表响应
- 发送人请求
- 发送人响应
- 发送人响应现有
- 发送人响应元数据
- 发送人状态
- 发送人Webhook
- 状态原因详情
- 交易
- 交易列表响应
- 交易请求
- 交易响应
- 交易响应现有
- 交易响应元数据
- 交易状态
- 交易特性
- 交易Webhook
- 验证错误描述
- Webhook
- Webhook定义
- Webhook定义事件列表响应
- Webhook定义列表响应
- Webhook定义请求
- Webhook定义响应
- Webhook日志
- Webhook日志列表响应
- Webhook日志元数据
- Webhook日志元数据请求
- Webhook日志元数据响应
- Webhook日志响应