How To Integrate PayKun Payment Gateway In Laravel

In this tutorial, there is stepwise guidance on how to integrate PayKun laravel. You will get an understanding to implement the PayKun Payment Gateway integration with your laravel application.

Firstly, you will need to sign up a PayKun Account, after signing up you will be able to generate the API Encryption key and also get the access to the Test Mode (Sandbox). In order to start collecting payments in the Live Mode, you will require to get the submitted details and documents successfully verified. Only after that will the PayKun account activated.

PayKun is the best payment gateway in India. It provides free integration services with zero setup fees and no maintenance charges. It provides easy to integrate Plugins and SDKs and provides a good development interface without any kind of charges.

Collecting online payments can be very easy with PayKun. You can provide multiple payment options to your customers and a great checkout experience. Also, they will get all sorts of payment options that will make them buy on the spot.

Checkout-PHP Requires

Merchant Id
Access Token
Encryption Key
php: >=5.3.0

Following are the steps for integration:

Step 1: Install Laravel

Get the Laravel application using the below-mentioned code and open your terminal OR command prompt.

Step 2: Install paykun-php Package

Install paykun-php through the Composer Package Manager using the following composer code or the required zip file.


Step 3: Set PayKun API Secret Key

Next, set the PayKun Access Token and the Encryption key. This can be obtained from the PayKun dashboard. Go to Settings Tab > Security option > Generate API Key and download your Access Token and Encryption Key(API Secret Key).

Step 4: How to Use PayKun Integration in Controller File

Next, you can put the below code in controller file


Now, you may carry out the testing with the following card details:

Card Number: 4111 1111 1111 1111

​Expiry Date: 11/22

CVV: 111

Name: Test

Follow the below step for generating test/sandbox mode credentials.
Click on your profile picture then after select test mode.
And click on your active sandbox account.
Copy your password.
Click on the sandbox login.
And then you will be redirected to the Sandbox Mode, then after you may generate your credentials as it is in live mode.

Please note:  set ‘isLive’ parameter is false for test/sandbox mode.

Leave a Comment