Wallogit.com
2017 © Pedro Peláez
ZF2 module to using Payline SDK
Based on Payline SDK, Payline-zf2 allows you to use it in a zf2 service. Payline is a way to do credit card payments online., (*1)
This is installable via Composer as gawel1/payline-zf2., (*2)
First, Copy the payline.local.php.dist in your application config and set the file with your own configuration. Then, you can get the payline service with the following code :, (*3)
$this->getServiceLocator()->get('payline');
$uri = $this->getRequest()->getUri();
$base = sprintf('%s://%s', $uri->getScheme(), $uri->getHost());
$response = $this->getServiceLocator->get('payline')->doWebPayment([
'returnURL' => $base . $this->url()->fromRoute('home'),
'cancelURL' => $base . $this->url()->fromRoute('home'),
'payment' => [
'amount' => 100,
'action' => 101,
'currency' => 978,
'mode' => PaylineService::CASH_PAYMENT,
'contractNumber' => $this->getServiceLocator()->get('config')['payline']['contractNumber']
],
'order' => [
'amount' => 100,
'ref' => 1,
'currency' => 978
]
]);
To see more informations about Payline and the API's, download this document., (*4)
To see more informations about the Payline SDK, download this document, (*5)