ixopay / ixopay-php-client
PHP Ixopay 客户端
v3.17.0
2024-07-30 19:45 UTC
Requires
- php: >=5.6
- ext-curl: *
- psr/log: *
- dev-master
- dev-main
- v3.x-dev
- v3.17.0
- v3.16.0
- v3.15.0
- v3.14.1
- v3.14.0
- v3.13.0
- v3.12.0
- v3.11.0
- v3.10.0
- v3.9.0
- v3.8.0
- v3.7.0
- v3.6.0
- v3.5.0
- v3.4.0
- v3.3.1
- v3.3.0
- v3.2.0
- v3.1.0
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v2.x-dev
- v2.5.4
- v2.5.3
- v2.5.2
- v2.5.1
- v2.5
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4
- v2.3.1
- v2.3
- v2.2
- v2.1.13
- v2.1.12
- v2.1.11
- v2.1.10
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.0.2
- v2.0.1
- v2.0.0
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-feature/industy_practice_for_transaction_indicator
- dev-feature/disputes
- dev-feature/deregister-type
- dev-feature/recipient-account-pan-correction
- dev-feature/sender-account-pan
- dev-feature/ngorbacs/add-scheme-reference-id
- dev-feature/3ds-fields
- dev-feature/update-documentation-links
- dev-feature/cp-pt-token-in-statuscall
- dev-feature/delayed-capture-x2148
- dev-feature/add-support-for-partial-deregisters
- dev-sandbox-beta
- dev-prerelease-dev
- dev-feature/level-2-3-data
- dev-feature/browser-platform
- dev-feature/eight-digit-bins
- dev-request-dcc-parameter
- dev-feature/rhofer/redirectQrCode
- dev-feature/error-object-improvements
- dev-feature/fix-error-parsing
- dev-feature/capture-description
- dev-feature/crosse/indicator-trait
- dev-feature/splitTx
- dev-feature/additionalWalletData
- dev-feature/json-api-phase2
- dev-feature/pay-by-link
- dev-feature/incremental-auths
- dev-feature/json-api-phase1
- dev-feature/sbuchegger/updateScheduleAPI
- dev-feature/mk/custom-headers
- dev-feature/customer-profiles
- dev-php7
- dev-feature/dku/customer-profiles
- dev-feature/account-updater
- dev-prerelease/2018_07
- dev-feature/rb/risk-checks-without-processing
- dev-php56
This package is auto-updated.
Last update: 2024-08-30 21:26:37 UTC
README
在您的 PHP 后端接受支付并集成 100 多种支付方式:IXOPAY PHP SDK 提供方便地访问 IXOPAY REST APIs。
安装
要求
- PHP 5.6 或更高版本
- 已安装 Composer
Composer
将 IXOPAY PHP SDK 添加到您的 composer.json
文件中。
composer require ixopay/ixopay-php-client
文档
有关如何使用交易处理 API 的通用信息,请参阅 IXOPAY 网关文档。
有关所有交易处理 API 调用的参考,请参阅 IXOPAY API 参考。
用法
先决条件
- IXOPAY 账户
- API 用户 - 包括
- 用户名,和
- 密码
- 连接器 - 包括
- API 密钥,和
- 可选:共享密钥
设置凭证
通过您的 API 用户名和密码认证一个新的 Ixopay\Client\Client
,将其连接到由 API 密钥标识的支付适配器,并使用共享密钥进行认证。
<?php use Ixopay\Client\Client; use Ixopay\Client\Data\Customer; use Ixopay\Client\Transaction\Debit; use Ixopay\Client\Transaction\Result; // Include the autoloader (if not already done via Composer autoloader) require_once('path/to/initClientAutoload.php'); // Instantiate the "Ixopay\Client\Client" with your credentials $api_user = "your_username"; $api_password = "your_username"; $connector_api_key = "your_chosen_connector_api_key"; $connector_shared_secret = "your_generated_connector_shared_secret"; $client = new Client($api_user, $api_password, $connector_api_key, $connector_shared_secret);
处理借记交易
一旦您创建了一个具有凭证的客户端,您就可以使用该实例来调用交易 API。
// define your transaction ID: e.g. 'myId-'.date('Y-m-d').'-'.uniqid() $merchantTransactionId = 'your_transaction_id'; // must be unique $customer = new Customer() $customer = $customer ->setBillingCountry("AT") ->setEmail("customer@example.org"); // after the payment flow the user is redirected to the $redirectUrl $redirectUrl = 'https://example.org/success'; // all payment state changes trigger the $callbackUrl hook $callbackUrl = 'https://api.example.org/payment-callback'; $debit = new Debit(); $debit = $debit->setTransactionId($merchantTransactionId) ->setSuccessUrl($redirectUrl) ->setCancelUrl($redirectUrl) ->setCallbackUrl($callbackUrl) ->setAmount(10.00) ->setCurrency('EUR') ->setCustomer($customer); // send the transaction $result = $client->debit($debit); // now handle the result if ($result->isSuccess()) { //act depending on $result->getReturnType() $gatewayReferenceId = $result->getReferenceId(); //store it in your database if ($result->getReturnType() == Result::RETURN_TYPE_ERROR) { //error handling $errors = $result->getErrors(); //cancelCart(); } elseif ($result->getReturnType() == Result::RETURN_TYPE_REDIRECT) { //redirect the user header('Location: '.$result->getRedirectUrl()); die; } elseif ($result->getReturnType() == Result::RETURN_TYPE_PENDING) { //payment is pending, wait for callback to complete //setCartToPending(); } elseif ($result->getReturnType() == Result::RETURN_TYPE_FINISHED) { //payment is finished, update your cart/payment transaction //finishCart(); } } ?>
支持
如果您对新增功能有建议,发现了错误,或遇到了技术问题,请在此创建问题。此外,您还可以根据您的合同联系 IXOPAY 的支持团队。
许可证
此存储库可在 MIT 许可证下使用。