nattreid / paygol
Paygol for Nette Framework
1.0.1
2019-07-01 08:41 UTC
Requires
- php: >= 7.1
- guzzlehttp/guzzle: ~6.3
- nattreid/form: ~1.0
- nattreid/utils: ~1.0
- nette/application: ~2.4
- nette/di: ~2.4
Requires (Dev)
- nattreid/web-manager: ~1.0
- nette/tester: ~1.7
- tracy/tracy: ~2.4
This package is auto-updated.
Last update: 2024-11-29 05:57:05 UTC
README
Nastavení v config.neon
extensions: paygol: NAttreid\Paygol\DI\PaygolExtension bPayments: serviceId: '123456789' conversionRate: xx
Použití
/** @var \NAttreid\Paygol\IPaygolClientFactory @inject */ public $paygolClientFactory; public function payment() { $payment = $this->createPayment(); $payment->identifier = 12345678; $payment->currency = 'EUR'; $payment->price = 100; $payer = new Payer(); $payer->identifier = 123456789; $payer->country = 'GB'; $payer->language = 'EUR'; $payer->email = 'some@email.com'; $payer->firstName = 'John'; $payer->lastName = 'Doe'; $payer->ip = '123.123.123.123'; $paygolClient = $this->paygolClientFactory->create(); $paygolClient->setSuccessUrl('//domain.com/success'); $paygolClient->setErrorUrl('//domain.com/error'); $response = $paygolClient->payment($payment, $payer); $this->order->setPaygolTransactionId($response->transactionId); $presenter->sendResponse($response->response); } public function paygolCheckPayment(): void { $paygol = $this->paygolClientFactory->create(); $status = $paygol->checkout($paygolTransactionId); if ($status->completed) { } elseif ($status->rejected) { } }