ShurjoPay payment gateway integration for PHP applications.

Overview

ShurjoPay payment gateway integration for PHP applications

ShurjoPay PHP Library

Using this library you can integrate ShurjoPay payment gateway into your PHP applications.


If you face any problem then create issues or make a PR with your solution.

Requirement

  • PHP 7.3 or Later
  • curl extension

Installation

The installation is pretty easy using Composer

composer require raziul/shurjopay-php

Usage

You can check the examples directory for full code.

Configuration

$config = [
	// set this to false if you are running in live mode
	'sandbox_mode'  =>  true,

	// ShurjoPay credentials [Change these with your details]
	'username' => 'sp_sandbox',
	'password' => 'pyyk97hu&6u6',
	'prefix'  =>  'NOK',
];

Creating a payment

require __DIR__ . '/vendor/autoload.php';

// create ShurjoPay instance
$sp = new \Raziul\ShurjoPay\ShurjoPay($config);

// set callback url
$sp->setCallbackUrl($success_url, $cancel_url);

// make payment
$sp->makePayment($payload); // it will redirect to the payment page

You can also use method chaining like below

ShurjoPay::create($config)->setCallbackUrl($success_url, $cancel_url)->makePayment($payload);

After making a successfull payment, user will be redirected to the success_url with order_id query parameter in the URI.

Verify Payment

// retrieve order id from the URI
$order_id = $_GET['order_id'];

// verify payment
$payment = $sp->verify($order_id);

// check success status
if ($payment->success()) {
	// show the payment method
	echo $payment->paymentMethod();
}

Available methods in the Payment class.

Method Description
$payment->success() Return payment success status
$payment->failed() Return payment failed status
$payment->message() Get the success/error message
$payment->orderId() Get the order ID
$payment->currency() Get currency code
$payment->amount() Get the amount
$payment->customerOrderId() Get customer order ID
$payment->paymentMethod() Get the payment method name
$payment->dateTime() Get the transaction date time
$payment->toArray() Get all the data as array

Error Handling

This package throws Raziul\ShurjoPay\ShurjoPayException on error. You can use try-catch for better error handling.

try {
	// making payment
	ShurjoPay::create($config)
		->setCallbackUrl($success_url, $cancel_url)
		->makePayment($payload);

	// also for verfication
	ShurjoPay::create($config)
		->verify($order_id);

} catch (Raziul\ShurjoPay\ShurjoPayException $e) {
	echo $e->getMessage();
}

Suggestion/Issues

If you found any issues or have any suggestion then please create an issue.

You can also submit PR regarding any issues.

License

The MIT License (MIT). Please see License File for more information.

Thank You

Thanks for using this package and If you foound this package useful then consider giving it a star.

You might also like...
Simple laravel package for 2C2P Payment Gateway.

Laravel 2C2P Payment Gateway Simple laravel package for 2C2P Payment Gateway. Installation You can install the package via composer: composer require

Provides Bitcoin-Lightning payment gateway powered by Strike
Provides Bitcoin-Lightning payment gateway powered by Strike

Bitcoin Payments - Powered by Strike Drupal module to allow user to pay with bitcoin on your Commerce website using Strike API. Strike Js is used for

MOKA > Opencart 2.3 Payment Gateway
MOKA Opencart 2.3 Payment Gateway

Moka - Opencart Payment Gateway Requirements PHP 5.6.0 and later. Dependencies The bindings require the following extensions in order to work properly

software development kit for purwantara.id payment gateway
software development kit for purwantara.id payment gateway

PURWANTARA LARAVEL ✨ What is Purwantara? Purwantara is a digital payment service provider that helps businesses to accept digital payments with seamle

一个支持在 Swoole 或其它非 Workerman 环境,开发 Gateway Worker 的组件。

Workerman Gateway SDK 一个支持在 Swoole 或其它非 Workerman 环境,开发 Gateway Worker 的组件。 支持用 Workerman Gateway 做网关,Swoole 编写业务代码。 安装 composer require yurunsoft/wor

Xenon\LaravelBDSms is a sms gateway package for sending text message to Bangladeshi mobile numbers using several gateways like sslcommerz, greenweb, dianahost,metronet in Laravel framework

Xenon\LaravelBDSms is a sms gateway package for sending text message to Bangladeshi mobile numbers using several gateways for Laravel. You should use

PHP package to communicate with the CMI payment plateform in Morocco
PHP package to communicate with the CMI payment plateform in Morocco

CMI PHP Payment bindings CMI PHP PAYMENT is an open source PHP payment handling library. it provides an easier way to communicate with CMI PAYMENT PLA

CPAY is a sdk that encapsulates the Orange Money api with an intuitive syntax allowing you to integrate the Orange Money payment into your PHP project.

CPAY CHOCO PAY is a sdk that encapsulates the Orange Money api with an intuitive syntax allowing you to integrate the Orange Money payment into your P

PHP 7+ Payment processing library. It offers everything you need to work with payments: Credit card & offsite purchasing, subscriptions, payouts etc. - provided by Forma-Pro

Supporting Payum Payum is an MIT-licensed open source project with its ongoing development made possible entirely by the support of community and our

Owner
Raziul Islam
I write code for humans that also runs fast on the machine 👩‍💻
Raziul Islam
The Laravel eCommerce ABA Payment Gateway module allows the admin to integrate the ABA payment gateway to the online store.

Introduction Bagisto ABA Payment Gateway. Requirements: Bagisto: v1.3.2. Installation with composer: Run the following command composer require bagist

Bagisto 3 May 31, 2022
The whmcs payment module for TigoPesa Payment Gateway.

whmcs-tigopesa INSTALLATION INSTRUCTIONS TIGOPESA WHMCS Please follow the instructions below to setup the whmcs-tigopesa gateway module. Download zipp

Medson Naftali 3 Dec 11, 2021
With the help of the Laravel eCommerce CashU Payment Gateway, the admin can integrate the CashU payment method in the Bagisto store.

Introduction Bagisto CashU Payment add-on allow customers to pay for others using CashU payment gateway. Requirements: Bagisto: v1.3.2 Installation wi

Bagisto 2 Aug 22, 2022
uPay(bangladesh) payment gateway integration package for laravel

uPay BD Payment Gateway Requirements PHP >=7.2 Laravel >= 6 Installation composer require codeboxr/upay vendor publish (config) php artisan vendor:pub

Codeboxr CodeHub 6 Sep 24, 2022
Laravel integration with paymob (accept) payment gateway

Paymob Laravel Package This is a laravel package to facilate integartion with paymob apis Paymob docs. Installation 1- You can install the package via

Mohamed Sakr 6 Jun 7, 2023
A framework agnostic, multi-gateway payment processing library for PHP 5.6+

Omnipay An easy to use, consistent payment processing library for PHP Omnipay is a payment processing library for PHP. It has been designed based on i

The League of Extraordinary Packages 5.7k Dec 30, 2022
Integrate Paytm Payment gateway to php website.

paytm-integration-kit-project-for-PHP Integrate Paytm Payment gateway to php website. Copy PaytmKit folder in document root of your server (like /var/

Er. Dipankar Mohanta 1 Feb 11, 2022
WHMCS Payment Gateway Module for Coinify

vrcoinify WHMCS Payment Gateway Module for Coinify Installing guide You should copy all contents from module folder to your WHMCS application folder u

VR DEV TEAM 3 Mar 15, 2022
A site to sell an E-book with paystack payment gateway integrated

YoungAndGetRich This is a platform to sell the named book using paystack payment gateway. Technology used are: MySql database PHP HTML5 CSS3 Bootstrap

Abiodun Sam 1 Oct 26, 2021
A payment gateway plugin for WooCommerce to see if your checkout works.

=== Order Test For All for WooCommerce === Contributors: ikamal Donate link: https://kamal.pw/ Tags: wc order test, wc order, woocommerce, woocommerce

Kamal 3 Dec 7, 2021