Download the PHP package cubes-doo/nestpay without Composer

On this page you can find all versions of the php package cubes-doo/nestpay. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package nestpay

Cubes Nestpay

Nestpay E-commerce integration, shipped with Laravel Package

Latest Stable Version Total Downloads License

Default usage

Installation

Require this package with composer.

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:

*If you are using Laravel there is a ready to use migration (see documentation below)

Bootstrap & Configuration

Main class to use is \Cubes\Nestpay\MerchantService

Instanciate the class and pass configuration parameters:

Setup the connection to the database by using existing PDO instance

If you want to have some other name for the nestpay_payments table, something you should pass another parameter

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

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

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

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 \Cubes\Nestpay\MerchantService::paymentMakeRequestParameters method to generate necessary parameters (the HASH parameter and other necessary parameters)

After submitting this form customer is redirected to 3D gate bank card processing page where customer enters Card Number, CVC etc.

The result page

After entering Card details, customer is redirected back to your website on success or fail url.

You should call \Cubes\Nestpay\MerchantService::paymentProcess3DGateResponse method to process $_POST parameters.

On success page:

On fail page:

Processing payment over API

When customer leaves the 3D Gate Page there is a possibility that he/she is NOT going to be redirected back to your website (internet connection broke, customer closes the browser etc.).

You should use \Cubes\Nestpay\MerchantService::paymentProcessOverNestpayApi method to process payment over API in some cron job.

Capture payment (PostAuth) over API

For two step payment (PreAuth and PostAuth) you should use Nestpay API to capture reserved amount of successful payment.

Use \Cubes\Nestpay\MerchantService::postAuthorizationOverNestpayApi

If you DO NOT want to capture entire amount, pass second parameter.

Void payment over API

To void payment use \Cubes\Nestpay\MerchantService::voidOverNestpayApi

Get working payment

If you want to get the last processed payment use \Cubes\Nestpay\MerchantService::getWorkingPayment

Customize saving payment information

If you prefer some other method to store payments, you should create "Data Access Object" class of your own. Your DAO class must implement \Cubes\Nestpay\PaymentDao interface:

Make \Cubes\Nestpay\MerchantService use your DAO class

Integration with Laravel Framework(>=5.4)

Package cubes-doo/nestpay comes with built Laravel package.

Service provider class is \Cubes\Nestpay\Laravel\NestpayServiceProvider.

If you are using Laravel version < 5.5 you must include service provider manually

Before using the \Cubes\Nestpay\MerchantService class you should edit your .env file:

The package provides \Cubes\Nestpay\MerchantService class which could be injected in controllers and other points in Laravel application:

Also \Cubes\Nestpay\MerchantService could be obtained using facade or service container:

For unprocessed payments (when customer does not navigate back to your site after payment by accident) there is also available artisan command:

Laravel resources (config, controllers, views , etc)

Although you could integrate Nestpay service into your Laravel application manually, this Laravel package has all you need to integrate Nestpay system.

  1. Publish package resources into your Laravel application:

  2. Customize published config file config/nestpay.php to your production parameters (keep your testing parameters in .env)

  3. Add Nestpay routes among others

  4. Add published event subscriber into your \App\Providers\EventServiceProvider

  5. Customize published migration for nestpay_payment table

  6. Customize published model \App\Models\NestpayPayment

  7. Customize controller \App\Http\Controllers\NestpayController

IMPORTANT NOTICE!!! You SHOULD NOT send emails to customer or have any logic which is related to the successful payment in this controller, because payment could be processed also over nestpay::handle-unprocessed-payments artisan command!

USE NestpayEventsSubscriber instead (see documentation below).

IMPORTANT NOTICE!!! Routes to actions NestpayController@success and NestpayController@fail MUST BE EXCLUDED FROM CSRF TOKEN VERIFICATION, exclude urls for that actions by editing VerifyCsrfTokent middleware

  1. Customize view scripts

  2. Schedule nestpay::handle-unprocessed-payments command to execute every five minutes, so unproccessed payments could be handled over Nestpay API in background

  3. Customize listener \App\Listeners\NestpayEventsSubscriber

IMPORTANT NOTICE!!!

THIS IS THE MOST IMPORTANT CUSTOMIZATION!!!

When payment is processed (eather over NestpayController or nestpay::handle-unprocessed-payments command) the following events are triggered:

At this point you should have the published event subscriber \App\Listeners\NestpayEventsSubscriber which is configured to listen to those events.

The class has logic for sending necessary mail to the customer, all you have to do is add logic when payment has been successfull (when custmer HAS PAID)


All versions of nestpay with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
ext-curl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cubes-doo/nestpay contains the following files

Loading the files please wait ....