bankette / omnipay-hipay
Integrate Hipay in omnipay
Installs: 54
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
pkg:composer/bankette/omnipay-hipay
Requires
- php: >=5.3.2
- omnipay/omnipay: ~2.0
This package is not auto-updated.
Last update: 2025-10-16 00:06:53 UTC
README
Omnipay gateway for hipay.
This code needs amelioration but is a good base to integrate hipay in your omnipay. Please feel free to fork and do PR to improve this library.
Purchase
Here is a code example for symfony to send a purchase request to hipay.
use Bankette\OmnipayHipay\Gateway; use Symfony\Component\HttpFoundation\Request as SymfonyRequest; /** * Payment by hipay Action. * * @return Response */ public function hipayPaymentAction(SymfonyRequest $request) { $data = [ 'orderid' => 'my-order-id', 'amount' => 10, 'currency' => 'EUR', 'card' => [ 'number' => '4000000000000002', 'expiryMonth' => '10', 'expiryYear' => '2020', 'cvv' => '123', ], 'cardtype' => 'visa', 'description' => 'description', ]; $gateway = new Gateway(); $gateway->setClientId($this->username); $gateway->setSecret($this->password); $gateway->setTestMode(true); $purchaseResponse = $gateway->purchase($data)->send(); if (!$purchaseResponse->isSuccessful() && !$purchaseResponse->isRedirect()) { throw new BadRequestHttpException($purchaseResponse->getError()); } if ($purchaseResponse->isSuccessful()) { // Payment validated } if ($purchaseResponse->isRedirect() && $purchaseResponse->getRedirectUrl()) { // Payment waiting for 3D secure validation } // ... }
Notify
After a purchase request, hipay will send notifications on the 'notification URL' defined in hipay back-office. The below controller will be called directly by hipay API on your API.
/** * @return Response * * @Route("/hipay/notify") * * @Method("POST") * * @View() * * @throws NotFoundHttpException */ public function hipayNotifyAction(SymfonyRequest $request) { $gateway = new Gateway(); $response = $gateway->completePurchase(); switch ($response->getStatus()) { // Status "Cardholder Enrolled" case '103': // Status "Cardholder Not Enrolled" case '104': // Status "Authorized" case '116': // Status "Capture Requested" case '117': // do something break; // Status "Captured" case '118': // do something break; // Status "Could Not Authenticate" case '108': // Status "Authentication Failed" case '109': // Status "Refused" case '113': // Status "Expired" case '114': // do something break; default: // do something break; } return new Response(); }