rahulreghunath/nttdatapay

nttdatapay payment gateway integration in laravel

1.1.0-beta 2022-09-28 11:32 UTC

This package is not auto-updated.

Last update: 2024-05-08 19:48:08 UTC


README

Laravel integration for NTT DATA PAY Payment gateway.

Installation

Install the package using using composer install.

composer require rahulreghunath/nttdatapay

Run the command to publish the configuration file.

php artisan vendor:publish --provider="Rahulreghunath\Nttdatapay\ServiceProvider"

Configuration

Set the credentials and configurations in config/nttdatapay.php file.

Configuration Description Required
encKey Encryption Key 68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f69636f6e732f656d6f6a692f756e69636f64652f323731342e706e67
decKey Decryption Key 68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f69636f6e732f656d6f6a692f756e69636f64652f323731342e706e67
payUrl Payment Url 68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f69636f6e732f656d6f6a692f756e69636f64652f323731342e706e67
transactionTrackingUrl Transaction Tracking Url 68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f69636f6e732f656d6f6a692f756e69636f64652f323734632e706e67
merchantId Merchant id 68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f69636f6e732f656d6f6a692f756e69636f64652f323731342e706e67
password Merchant Password 68747470733a2f2f6769746875622e6769746875626173736574732e636f6d2f696d616765732f69636f6e732f656d6f6a692f756e69636f64652f323731342e706e67

Please note that the configurations will be different for testing and production environments and will be provided by NTT DATA.

Usage

Create Token Id

use the method createTokenId($data) to create token id to initiate the payment request.

sample data

$data = [
    "payInstrument" => [
        "headDetails" => [
            "version" => "OTSv1.1",
            "api" => "AUTH",
            "platform" => "FLASH"
        ],
        "merchDetails" => [
            "merchTxnId" => "Test123450",
            "merchTxnDate" => "2021-09-04 20:46:00"
        ],
        "payDetails" => [
            "amount" => "1",
            "product" => "PRODUCT", // optional value
            "custAccNo" => "ACC NO", // optional value
            "txnCurrency" => "INR"
        ],
        "custDetails" => [
            "custEmail" => "user@email.com",
            "custMobile" => "0000000000"
        ],
        "extras" => [
            "udf1" => "", // optional value
            "udf2" => "", // optional value
            "udf3" => "", // optional value
            "udf4" => "", // optional value
            "udf5" => "" // optional value
        ]
    ]
];
$payment = new Atom();

$atomTokenId = $payment->createTokenId($data);

Calling Javascript API

Use the Atom Token Id to call the javascript API

<button onclick="pay()">Pay</button>

<script src="CDN provided by NTT DATA"></script>

<script> 
    const pay=()=>{
        const options = {
            atomTokenId: "atomTokenId ", // token id get from atom
            merchId: "000000", // merchant id
            custEmail: "customer-email",
            custMobile: "customer-mobile",
            returnUrl: "your-response-url"
        }
        const atom = new AtomPaynetz(options,'uat');
    }
</script>

Mandatory JavaScript CDN link will be provided by NTT DATA and will be different for production and testing environments.

Check Transaction Status

check the status of the payment using transactionStatus($merTxn,$amt,$date) method.

$payment = new Atom();

$response = $payment->transactionStatus($merchantTransactionId,$amount,$date);

Decrypt Response

use decrypt($data) to decrypt the response message from Atom.

$payment = new Atom();

$jsonData = $payment->decrypt($encryptedData,$digest_algo="sha512");

default hashing algorithm used is sha512 and can be use different algorithm based as per NTT DATA's specifications.