1. Go to this page and download the library: Download thanpa/paycenter-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
thanpa / paycenter-bundle example snippets
// app/AppKernel.php
// ...
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = array(
// ...
new Thanpa\PaycenterBundle\ThanpaPaycenterBundle(),
);
// ...
}
// ...
}
public function successAction()
{
$service = $this->get('thanpa_paycenter.payment_response');
$paymentResponse = $service->extract($request);
// your logic here: set order as 'paid', notify customer etc
$this->addFlash('success', $service->getDisplayMessage($paymentResponse));
// redirect where you need to redirect
}
public function failAction()
{
$service = $this->get('thanpa_paycenter.payment_response');
$paymentResponse = $service->extract($request);
// your logic here: set order as 'payment failed', email customer etc
$this->addFlash('error', $service->getDisplayMessage($paymentResponse));
// redirect where you need to redirect
}
public function backlinkAction()
{
$service = $this->get('thanpa_paycenter.payment_response');
$paymentResponse = $service->extract($request);
// your logic here: actually probably nothing
$this->addFlash('warning', $this->get('translator')->trans('You clicked cancel!'));
// redirect where you need to redirect
}
// ...
// get ticket issuer service
$issuer = $this->get('thanpa_paycenter.ticket_issuer');
$issuer->setMerchantReference($orderReference); // your unique order identifier
$ticket = $issuer->getTicket();
return $this->redirect(
$this->generateUrl(
'redirectToBank',
[
'languageCode' => 'el-GR',
'merchantReference' => $orderReference, // or your unique order/payment identifier
]
)
);
unit.xml.dist
POST
PaymentController.php
payment_fail
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.