PHPackages                             iammiloslukic/nestpay - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. iammiloslukic/nestpay

ActiveLibrary[Payment Processing](/categories/payments)

iammiloslukic/nestpay
=====================

Nestpay - Forked and modified by Milos Lukic

v1.0.0(1y ago)06MITPHPPHP &gt;=5.6

Since Oct 21Pushed 1y agoCompare

[ Source](https://github.com/iammiloslukic/nestpay)[ Packagist](https://packagist.org/packages/iammiloslukic/nestpay)[ Docs](https://github.com/readycmsio/nestpay)[ RSS](/packages/iammiloslukic-nestpay/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Cubes Nestpay
=============

[](#cubes-nestpay)

Nestpay E-commerce integration, shipped with Laravel Package

[![Latest Stable Version](https://camo.githubusercontent.com/b84b1a3ebe5d844d6cf6483cda9af1ba6c05579698bde49b6fd89f28d2048c9c/68747470733a2f2f706f7365722e707567782e6f72672f63756265732d646f6f2f6e6573747061792f762f737461626c65)](https://packagist.org/packages/cubes-doo/nestpay) [![Total Downloads](https://camo.githubusercontent.com/d299f3df78b16b75fd1168773d4e3587407436b377e0f17cc7149f3a7f43fe5e/68747470733a2f2f706f7365722e707567782e6f72672f63756265732d646f6f2f6e6573747061792f646f776e6c6f616473)](https://packagist.org/packages/cubes-doo/nestpay) [![License](https://camo.githubusercontent.com/a5e84c226aabb2187791b228395db33c38368ba786f26e3dd53b9538c3f774aa/68747470733a2f2f706f7365722e707567782e6f72672f63756265732d646f6f2f6e6573747061792f6c6963656e7365)](https://packagist.org/packages/cubes-doo/nestpay)

Default usage
-------------

[](#default-usage)

### Installation

[](#installation)

Require this package with composer.

```
composer require cubes-doo/nestpay
```

For this package to work you need table **nestpay\_payments** in database. This table is used to store information about payments.

You could create table by importing example SQL script:

```
mysql -u root -p your_db_name  '********',
    'storeKey' => '********',
    'storeType' => '3D_PAY_HOSTING',
    'okUrl' => 'http://localhost:8082/examples/success.php', //this could be configured later
    'failUrl' => 'http://localhost:8082/examples/failed.php', //this could be configured later
    '3DGateUrl' => 'https://testsecurepay.eway2pay.com/fim/est3Dgate',

    //API
    'apiName' => '********',
    'apiPassword' => '********',
    'apiEndpointUrl' => 'https://testsecurepay.eway2pay.com/fim/api'
]);
```

Setup the connection to the database by using existing PDO instance

```
$nestpayMerchantService->setPDO($pdo); //$pdo is instanceof \PDO
```

If you want to have some other name for the **nestpay\_payments** table, something you should pass another parameter

```
$nestpayMerchantService->setPDO($pdo, 'your_table'); //'your_table' is name of the table for payments
```

Configure **\\ReadyCMSIO\\Nestpay\\MerchantService** what to do when successful payment occurres or what to do on failed payment:

```
$merchantService->onFailedPayment(function ($payment) {
    //$payment is instance of \ReadyCMSIO\Nestpay\Payment

    //send an email for failed payment attempt
    // $email = $payment->getProperty(\ReadyCMSIO\Nestpay\Payment::PROP_EMAIL);
    // $customerName = $payment->getProperty(\ReadyCMSIO\Nestpay\Payment::PROP_BILLTONAME);

})->onSuccessfulPayment(function($payment) {
    //$payment is instance of \ReadyCMSIO\Nestpay\Payment

    //send an email for successful payment
    // $email = $payment->getProperty(\ReadyCMSIO\Nestpay\Payment::PROP_EMAIL);
    // $customerName = $payment->getProperty(\ReadyCMSIO\Nestpay\Payment::PROP_BILLTONAME);

    //do stuff related to the siccessfull payment
});
```

**IMPORTANT NOTICE!!!**The **onSuccessfulPayment** and **onFailedPayment** could be triggered in 2 ways

- By calling **\\ReadyCMSIO\\Nestpay\\MerchantService::paymentProcess3DGateResponse** when customer is redirected back to you page (see documentation below)
- By calling **\\ReadyCMSIO\\Nestpay\\MerchantService::paymentProcessOverNestpayApi** from your cron job (see documentation below)

For that reason it is important to write your logic, like sending email or changing the order status, for successuful or failed payment IN THIS HANDLERS!!! (so you don't have to write it twice)

### Usage

[](#usage)

#### The confirmation page

[](#the-confirmation-page)

You should have confirmation page from which customers are redirected to the bank card processor page.

That page should have form with lots of hidden paramters.

Use **\\ReadyCMSIO\\Nestpay\\MerchantService::paymentMakeRequestParameters** method to generate necessary parameters (the HASH parameter and other necessary parameters)

```
