PHP code example of netpay / omnipay-netpay
1. Go to this page and download the library: Download netpay/omnipay-netpay 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/ */
netpay / omnipay-netpay example snippets
$gateway = Omnipay::create('NetPay_Api');
$gateway->setTestMode(TRUE);
$gateway->setLiveEndpoint($liveUrl);
$gateway->setTestEndpoint($testUrl);
$gateway->setMerchantId($merchant_id);
$gateway->setUsername($username);
$gateway->setPassword($password);
$gateway->setCertificatePath($path_to_cert);
$gateway->setCertificateKeyPath($path_to_key);
$gateway->setCertificatePassword($cert_password);
$response = $gateway->purchase(array('amount' => '10.00', 'currency' => 'GBP', 'card' => $card))->send();
$response = $gateway->authorize(array('amount' => '10.00', 'currency' => 'GBP', 'card' => $card))->send();
$orderId = $response->getOrderId();
$response = $gateway->capture(array('amount' => '10.00', 'currency' => 'GBP', 'orderId' => $orderId))->send();
$response = $gateway->refund(array('amount' => '10.00', 'currency' => 'GBP', 'orderId' => $orderId))->send();
$transactionId = $response->getTransactionId();
$response = $gateway->retrieveTransaction(array('transactionId' => $transactionId, 'orderId' => $orderId))->send();
$response = $gateway->void(array('voidTransactionId' => $transactionId, 'orderId' => $orderId))->send();
$response = $gateway->createCard(array('card' => $card, 'tokenPermanent' => TRUE))->send();
$token = $response->getToken();
$response = $gateway->deleteCard(array('token' => $token))->send();
$response = $gateway->retrieveCard(array('token' => $token))->send();
$response = $gateway->purchase(array('amount' => '10.00', 'currency' => 'GBP', 'token' => $token, 'cvv' => $cvv))->send();
$response = $gateway->authorize(array('amount' => '10.00', 'currency' => 'GBP', 'token' => $token, 'cvv' => $cvv))->send();
$response->isSuccessful();
$response->getMessage();
$response->getCode();
$response->getAuthorizationCode();
$response->getReceipt();
$response->getOrderId();
$response->getTotalAuthorizedAmount();
$response->getTotalCapturedAmount();
$response->getRefundedAmount();
$response->getGatewayCode();
$response->getCSCCode();
$response->getCSCGatewayCode();
$response->getAVSCode();
$response->getAVSGatewayCode();