paygreen / paygreen-php
PayGreen PHP SDK
1.3.17
2024-01-02 13:46 UTC
Requires
- php: >=5.6
- ext-curl: *
- ext-json: *
- guzzlehttp/psr7: >=1.8.4
- php-http/httplug: >=1.0
- php-http/message: >=1.7.2
- psr/log: >=1.1.4
Requires (Dev)
- behat/behat: ^3.7
- php-http/curl-client: ^1.7.1
- php-http/mock-client: ^1.3
- php-webdriver/webdriver: ^1.13
- phpunit/phpunit: ^5.7.27
- symfony/dotenv: ^3.4.47
- symfony/var-dumper: ^3.4.47
- dev-master
- 1.3.17
- 1.3.16
- 1.3.15
- 1.3.14
- 1.3.13
- 1.3.11
- 1.3.10
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-develop
- dev-SPH-250-edit-payment-config
- dev-SPH-247-les-tests-behat-ne-passent-pas-sur-github
- dev-SPH-237-prefix-user-agent
- dev-SPH-220-fix-get-routes
- dev-SPH-223-list-params
- dev-SPH-227-bis-contributing-md
- dev-SPH-229-create-shop-incomplet
- dev-SPH-227-contributing-md
- dev-SPH-226-add-log-event-behat-test
- dev-SPH-224-docker-compose-vpn
- dev-SPH-221-behat-readme-keys
- dev-SPH-217-correction-test-behat
This package is auto-updated.
Last update: 2024-08-31 00:36:13 UTC
README
🚀 开始使用
安装
composer require paygreen/paygreen-php
需求
- PHP 5.6 及以上版本。
- PSR-18 HTTP 客户端,如 Guzzle 或 curl-client
示例
use Http\Client\Curl\Client; use Paygreen\Sdk\Payment\V2\PaymentClient; $environment = new Environment('YOUR_PUBLIC_KEY', 'YOUR_PRIVATE_KEY', 'SANDBOX', 2); $client = new PaymentClient(new Client(), $environment); $customer = new Paygreen\Sdk\Payment\V2\Model\Customer(); $customer->setId('my-customer-id'); $customer->setEmail('john.doe@customer.fr'); // ... and setStreetLineOne, setLastName $shippingAddress = new Paygreen\Sdk\Payment\V2\Model\Address(); $shippingAddress->setCity('London'); // ... and setStreetLineOne, setCountryCode, setPostcode $billingAddress = new Paygreen\Sdk\Payment\V2\Model\Address(); $billingAddress->setCity('London'); // ... and setStreetLineOne, setCountryCode, setPostcode $order = new Paygreen\Sdk\Payment\V2\Model\Order(); $order->setCustomer($customer); $order->setBillingAddress($billingAddress); $order->setShippingAddress($shippingAddress); $order->setReference('my-order-reference'); $order->setAmount(2650); $order->setCurrency('EUR'); $paymentOrder = new Paygreen\Sdk\Payment\V2\Model\PaymentOrder(); $paymentOrder->setType('CASH'); $paymentOrder->setOrder($order); $paymentOrder->setNotifiedUrl('https://localhost/notify'); $response = $paymentClient->createCashPayment($paymentOrder);
📚 文档
查看文档。
🚀 Paygreen V3 的文档可在此找到。
🚧 测试
启动 docker stack
docker-compose up -d
PHPUnit 测试
docker-compose exec php vendor/bin/phpunit tests
Behat 测试
docker-compose exec php vendor/bin/behat