Search by

pmgw / payment-gateway-php7-sdk

pmgw-hu

This package is abandoned and no longer maintained. The author suggests using the nevogate/payment-gateway-sdk package instead.

Nevogate Payment Gateway SDK

Package info

github.com/Nevogate/payment-gateway-sdk-php

Homepage

pkg:composer/pmgw/payment-gateway-php7-sdk

Statistics

Installs: 23 028

Dependents: 1

Suggesters: 0

Stars: 6

Open Issues: 0

5.6.0 2026-11-23 08:30 UTC

README

Repository github.com/pmgw-hu/payment-gateway-php7-sdk (pmgw/payment-gateway-php7-sdk) is abandoned, you should avoid using it.

Use https://github.com/nevogate/payment-gateway-sdk-php (nevogate/payment-gateway-sdk) instead.

Nevogate Payment Gateway SDK - PHP

Version

5.6.0

Requirements

  • PHP 7.2
  • PHP cURL extension
  • PHP OpenSSL extension
  • PHP JSON extension

Installation

Nevogate Payment Gateway is available at packagist.org, so you can use composer to download this library.

{
    "require": {
        "nevogate/payment-gateway-sdk": "^5.1@stable"
    }
}

or run

composer require nevogate/payment-gateway-sdk

Technical documentation

https://docs.nevogate.com/

Source code

https://github.com/nevogate/payment-gateway-sdk-php

Example usage

Basic configuration

$config = new \Nevogate\PaymentGateway\Config();
$config->storeName = "example store name";
$config->apiKey = "ExamPleApiKey";
$config->encryptPublicKey = "publicKeyGoesHere";
$config->testMode = true;
$config->debugCommunication = true; // Get info about the communication (curl) with the payment gateway

$paymentGateway = new \Nevogate\PaymentGateway($config);

Init request

$init = new \Nevogate\PaymentGateway\Request\Init();
$init->setProviderName(\Nevogate\PaymentGateway::PROVIDER_CIB) // the chosen payment method
    ->setResponseUrl('http://your.companys.webshop.url/payment_gateway_response') // callback url
    ->setAmount(1234)
    ->setCurrency('HUF')
    ->setOrderId('ORD-1234') // your custom order id
    ->setUserId('USER-1234') // your custom user id
    ->setLanguage('HU');

$response = $paymentGateway->send($init);

Start request

if (!$response->ResultCode == "SUCCESSFUL" || !$response->TransactionId) {
    // handle error here
}

$paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\Start())->setTransactionId($response->TransactionId)
    );

Result request

$result = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\Result())->setTransactionId($_GET['TransactionId'])
    );

Details request

$details = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\Details())->setTransactionId($_GET['TransactionId'])
    );

Close request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\Close())->setTransactionId($transactionId)
    );

Refund request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\Refund())
            ->setTransactionId($transactionId)
            ->setAmount(100)
    );

Payout request

$payout = new \Nevogate\PaymentGateway\Request\Payout();
$payout->setPayoutType(\Nevogate\PaymentGateway::PAYOUT_TYPE_FUNDS_DISBURSEMENT)
    ->setReferenceTransactionId("783593c87fee4d372f47f53840028682")
    ->setAmount(200)
    ->setOrderId("NEVOGATE-TEST-ORDER-REG") // your custom order id
    ->setAdditionalMessage("NEVOGATE-TEST-PAYOUT-MESSAGE");

$response = $paymentGateway->send($payout);

Get payment registrations request

$response = $paymentGateway->send(
    (new \Nevogate\PaymentGateway\Request\GetPaymentRegistrations())
        ->setProviderName(\Nevogate\PaymentGateway::PROVIDER_BARION2)
        ->setUserId('User1')
    );

Get payment registration request

$response = $paymentGateway->send(
    (new \Nevogate\PaymentGateway\Request\GetPaymentRegistration())
        ->setTransactionId($transactionId)
);

Cancel payment registration request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\CancelPaymentRegistration())->setTransactionId($transactionId)
    );

Cancel all payment registrations request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\CancelAllPaymentRegistrations())
            ->setProviderName(\Nevogate\PaymentGateway::PROVIDER_BORGUN2)
            ->setUserId('userId')
    );

Init Recurring Payment - InitRP

$initRP = new \Nevogate\PaymentGateway\Request\InitRP();
$initRP->setReferenceTransactionId("783593c87fee4d372f47f53840028682")
    ->setResponseUrl("http://your.companys.webshop.url/payment_gateway_response") // callback url
    ->setAmount(200)
    ->setCurrency("HUF")
    ->setOrderId("NEVOGATE-TEST-ORDER-REG") // your custom order id
    ->setUserId("NEVOGATE-TEST-USER-REG");

$response = $paymentGateway->send($initRP);

StartRP request

if (!$response->ResultCode == "SUCCESSFUL" || !$response->TransactionId) {
    // handle error here
}

$result = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\StartRP())->setTransactionId($response->TransactionId)
    );

Native Google Pay wallet flow

InitWallet carries the wallet metadata only; the Google Pay token is sent later, in StartWallet.

$initWallet = (new \Nevogate\PaymentGateway\Data\Wallet())
    ->setType(\Nevogate\PaymentGateway\Data\Wallet::TYPE_GOOGLE_PAY)
    ->setEnvironment(\Nevogate\PaymentGateway\Data\Wallet::ENVIRONMENT_WEB)
    ->setPayerEmailAddress($payerEmailAddress);

$initRequest = (new \Nevogate\PaymentGateway\Request\InitWallet())
    // Set the regular Init fields here (provider, amount, URLs, order data, ...).
    ->setWallet($initWallet);

Native Apple Pay wallet flow

By default InitWallet performs the Apple Pay merchant validation: send it from the onvalidatemerchant event with the ValidationUrl (the event.validationURL issued by Apple) and the ShopUrl, and pass the returned ApplePaySessionResponse to session.completeMerchantValidation(). The Apple Pay token is sent later, in StartWallet.

$initWallet = (new \Nevogate\PaymentGateway\Data\Wallet())
    ->setType(\Nevogate\PaymentGateway\Data\Wallet::TYPE_APPLE_PAY)
    ->setEnvironment(\Nevogate\PaymentGateway\Data\Wallet::ENVIRONMENT_WEB)
    ->setValidationUrl($validationUrl) // received from Apple in the onvalidatemerchant event
    ->setShopUrl('https://demo.nevogate.com');

$initRequest = (new \Nevogate\PaymentGateway\Request\InitWallet())
    // Set the regular Init fields here (provider, amount, URLs, order data, ...).
    ->setWallet($initWallet);

ValidateWalletSession request (Apple Pay, Barion2 only)

For a fast checkout, where the final amount and the contact data are known only after the payment sheet is authorized, the merchant validation can be requested separately, without creating a transaction. Send it from the onvalidatemerchant event and pass the returned ApplePaySessionResponse to session.completeMerchantValidation().

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\ValidateWalletSession())
            ->setProviderName(\Nevogate\PaymentGateway::PROVIDER_BARION2)
            ->setCurrency('HUF')
            ->setAutoCommit(true) // must match the later InitWallet, see below
            ->setWallet(
                (new \Nevogate\PaymentGateway\Data\Wallet())
                    ->setType(\Nevogate\PaymentGateway\Data\Wallet::TYPE_APPLE_PAY)
                    ->setEnvironment(\Nevogate\PaymentGateway\Data\Wallet::ENVIRONMENT_WEB)
                    ->setValidationUrl($validationUrl) // received from Apple in the onvalidatemerchant event
                    ->setShopUrl('https://demo.nevogate.com')
            )
    );

The currency and the auto commit select the store provider (e.g. the Barion POSKey of the merchant session), so they must be the same as in the later InitWallet; an omitted auto commit means true.

Then, in the onpaymentauthorized event, send the InitWallet with the final amount and order data, and with setSessionValidated(true) - the merchant session already exists, so no new one is requested. Finally send the StartWallet with the Apple Pay token.

Without setSessionValidated(true) the InitWallet performs the merchant validation again and requires the ValidationUrl. setSessionValidated(true) is accepted only for Barion2 Apple Pay; any other provider or wallet type rejects it. setSessionValidated(false) is the same as not setting it, so it is accepted everywhere.

$initWallet = (new \Nevogate\PaymentGateway\Data\Wallet())
    ->setType(\Nevogate\PaymentGateway\Data\Wallet::TYPE_APPLE_PAY)
    ->setEnvironment(\Nevogate\PaymentGateway\Data\Wallet::ENVIRONMENT_WEB)
    ->setSessionValidated(true);

$initRequest = (new \Nevogate\PaymentGateway\Request\InitWallet())
    ->setProviderName(\Nevogate\PaymentGateway::PROVIDER_BARION2)
    // Set the regular Init fields here (amount, URLs, order data, Info, ...).
    ->setWallet($initWallet);

StartWallet request

Apple Pay
$response = $paymentGateway->send(
    (new \Nevogate\PaymentGateway\Request\StartWallet())
        ->setTransactionId($transactionId)
        ->setToken($applePayToken)
);
Google Pay
$response = $paymentGateway->send(
    (new \Nevogate\PaymentGateway\Request\StartWallet())
        ->setTransactionId($transactionId)
        ->setToken($googlePayToken)
);

CompleteWallet request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\CompleteWallet())->setTransactionId($transactionId)
    );

Create Payment Link - PaymentLinkCreate

$paymentLink = new \Nevogate\PaymentGateway\Request\PaymentLinkCreate();
$paymentLink->setProviderName(\Nevogate\PaymentGateway::PROVIDER_CIB) // the chosen payment method
    ->setAmount(1234)
    ->setCurrency('HUF')
    ->setOrderId('ORD-1234') // your custom order id
    ->setUserId('USR-1234') // your customer id
    ->setLanguage('HU');

$response = $paymentGateway->send($paymentLink);

Cancel request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\PaymentLinkCancel())->setPaymentLinkName($paymentLinkName)
    );

Details request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\PaymentLinkDetails())->setPaymentLinkName($paymentLinkName)
    );

Info data

Basic usage

$infoObject = new \Nevogate\PaymentGateway\Data\Info();

$infoCustomerGeneral = new \Nevogate\PaymentGateway\Data\Info\Customer\InfoCustomerGeneral();
$infoCustomerGeneral->setFirstName("John")
    ->setLastName("Doe")
    ->setEmail("test@testmail.com");

$infoObject->setObject($infoCustomerGeneral); //add $infoCustomerGeneral to $infoObject
 
$infoShipping = new \Nevogate\PaymentGateway\Data\Info\Order\InfoOrderShippingData();
$infoShipping->setFirstName("John")
    ->setLastName("Doe")
    ->setEmail("test@testmail.com")
    ->setPhoneCc("36")
    ->setPhone("801234567")
    ->setCity("Budapest");

$infoObject->setObject($infoShipping); //add $infoShipping to $infoObject
 
$infoOrderProductItem = new \Nevogate\PaymentGateway\Data\Info\Order\InfoOrderProductItem();
$infoOrderProductItem->setSku("PMG055005")
    ->setName("Product11")
    ->setQuantity("10")
    ->setQuantityUnit("db")
    ->setUnitPrice("22.00")
    ->setImageUrl("http://webhsop/product11.jpg")
    ->setDescription("Product11 desc.");

$infoObject->setObject($infoOrderProductItem); //add $infoOrderProductItem to $infoObject
 
$infoOrderProductItem = new \Nevogate\PaymentGateway\Data\Info\Order\InfoOrderProductItem();
$infoOrderProductItem->setSku("PMG055008")
    ->setName("Product12")
    ->setQuantity("10")
    ->setQuantityUnit("db")
    ->setUnitPrice("22.00")
    ->setImageUrl("http://webhsop/product12.jpg")
    ->setDescription("Product12 desc.");

$infoObject->setObject($infoOrderProductItem); //add $infoOrderProductItem to $infoObject

Init

...
    $init->setInfo($infoObject);
...

Payout

...
    $payout->setInfo($infoObject);
...

InitRP

...
    $initRP->setInfo($infoObject);
...

Payment Link

...
    $paymentLink->setInfo($infoObject);
...