2017 © Pedro Peláez
 

library checkout

TraknPay Payment Gateway Integration

image

traknpay/checkout

TraknPay Payment Gateway Integration

  • Saturday, October 15, 2016
  • by karmendra
  • Repository
  • 2 Watchers
  • 1 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 4 % Grown

The README.md

Laravel 5.x Latest Stable Version Latest Unstable Version Total Downloads License, (*1)

Checkout

Traknpay/Checkout is a Laravel package to integrate traknpay payment gateway in your laravel 5.X package, (*2)

This package is used to integrate with traknpay api payment request., (*3)

Requirements

The Checkout package is working fine in Laravel 5.1 and 5.3.However , in laravel 5.2, there is a minor issue when response is not handled.If response is handled as described in the below steps then there would be no issue., (*4)

  1. PHP 5.4.0 or later
  2. Laravel 5.1 or 5.3

Quick Installation

To get started, install Checkout via the Composer package manager:, (*5)

composer require traknpay/checkout

Service Provider

Next,register the Checkout service provider in the providers array of your config/app.php configuration file:, (*6)

TraknPay\Checkout\CheckoutServiceProvider::class

Facade

Add 'Checkout' facade in the aliases array of your config/app.php configuration file:, (*7)

'Checkout'=>TraknPay\Checkout\Facades\Checkout::class

Configuration

Publish the configuration:, (*8)

php artisan vendor:publish

config/traknpay_payment_gateway.php, (*9)

This is the configuration file that Laravel will publish into your config directory., (*10)

Open this file and provide values in following parameters, (*11)

'api_key'
'app_url'
'salt'
'mode'

'app_url' is to be set to your server url, by default it is set to http://localhost:8000, do not add '/' at end of this url, (*12)

'api_key' and 'salt' values are provided by Traknpay., (*13)

'mode' value can be either TEST or LIVE., (*14)

For the rest of the parameters that need to be sent , please refer the traknpay integration document TraknPay_Integration_Guide_Ver1.4.1., (*15)

Usage

To post the payment parameters to traknpay gateway, on clicking checkout button do following., (*16)

    Checkout::post([
        'order_id'       => '10',
        'amount'         => '201.00',
        'name'           => 'Payer Name',
        'email'          => 'Payer@example.com',
        'phone'          => '9876543210',
    ]);

Handling Response

There is an inbuilt response handler but that does not do much, apart from showing if the transaction was Successful or Failed. To handle the response on your own, use the following steps., (*17)

  1. Create a controller (e.g. PaymentController), (*18)

  2. Create a function within this controller(e.g. handleResponse), (*19)

  3. In handleResponse function, perform hash check and then update your payment status., (*20)


    use TraknPay\Checkout\Facades\Checkout; class PaymentController extends Controller { public function handleResponse(Request $request) { if(Checkout::checkResponseHash($request->all())){ // if checkResponseHash returns true, continue to save the response. } else { // if checkResponseHash returns false , then it means that response might be tampered } } }
  4. Add the new route to web.php file., (*21)

        Route::post('/paymentresponse','PaymentController@handleResponse');
    
  5. Add this route in exception list of VerifyCsrfToken in the middleware., (*22)

  6. Update app_url and return_url in config/traknpay_payment_gateway.php., (*23)

        'app_url'    => 'http://your-site.com'
        'return_url' => '/paymentresponse'
    

The Versions

15/10 2016

dev-master

9999999-dev http://www.traknpay.com

TraknPay Payment Gateway Integration

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Sharathkumar Hegde

13/10 2016

v1.0

1.0.0.0 http://www.traknpay.com

TraknPay Payment Gateway Integration

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Sharathkumar Hegde