nimbles-nl / 在线支付平台
PHP 在线支付平台包
1.0.4
2017-08-29 09:07 UTC
Requires
- php: >=5.5.9
- guzzlehttp/guzzle: ~6.3
Requires (Dev)
- phpunit/phpunit: ^6.1
This package is not auto-updated.
Last update: 2024-09-29 04:03:27 UTC
README
此项目已不再维护
使用composer下载包
运行命令安装包
$ composer require nimbles-nl/online-betaal-platform
初始化OnlineBetaalPlatform
$guzzle = new Client(); $apiToken = 'secret-token'; $apiUrl = 'https://api-sandbox.onlinebetaalplatform.nl/v1'; $onlineBetaalPlatform = new OnlineBetaalPlatform($guzzle, $apiToken, $apiUrl);
发送支付请求
$amount = 10050; // in cents 100 = 1 euro. $payment = new Payment('https://www.mywebsite.nl/return-url', $amount); $product = new Product('Apple pie', 950, 1); $payment->addProduct($product); $payment = $onlineBetaalPlatform->createTransaction($payment); $payment->getUid(); // remember this uuid.. return new RedirectResponse($payment->getRedirectUrl());
接收支付请求
$uuid = 'uuid-received-from-create-method-above'; $payment = $onlineBetaalPlatform->getTransaction($uuid); if ($payment->isSuccess()) { // Your payment is successful } else { // Oops try again.. }
接收付款
$payments = $onlineBetaalPlatform->getTransactions();
初始化商户管理器
$guzzle = new Client(); $apiToken = 'secret-token'; $apiUrl = 'https://api-sandbox.onlinebetaalplatform.nl/v1'; $merchantManager = new MerchantsManager($guzzle, $apiToken, $apiUrl);
创建商户
$merchant = $merchantManager->createMerchant('Klaas', 'Bruinsma', 'klaas@bruinsma.nl', '0031612345678');