PHP code example of shurjomukhi / shurjopay-plugin-php
1. Go to this page and download the library: Download shurjomukhi/shurjopay-plugin-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shurjomukhi / shurjopay-plugin-php example snippets
# shurjopay merchant username
SP_USERNAME='sp_sandbox'
# shurjopay merchant password
SP_PASSWORD='pyyk97hu&6u6'
# Merchant prefix used to generate order id
SP_PREFIX='NOK'
# shurjopay payment gateway API endpoint
SHURJOPAY_API='https://sandbox.shurjopayment.com'
# URL to redirect after completion of a payment. Sample: https://sandbox.shurjopayment.com/response
SP_CALLBACK='http://localhost/your-php-app/return.php'
# Log location of shurjopay php plugin
SP_LOG_LOCATION='/var/log/shurjopay'
# CURLOPT_SSL_VERIFYPEER=0 only for local and non-SSL environment
CURLOPT_SSL_VERIFYPEER=1
$env = new ShurjopayEnvReader(__DIR__ . '/_env');
$sp_instance = new Shurjopay($env->getConfig());
$request = new PaymentRequest();
# All the data will come from user end.
$request->currency = 'BDT';
$request->amount = 100;
$request->discountAmount = 0;
$request->discPercent = 0;
$request->customerName = 'Abdul Mannan';
$request->customerPhone = '01712345678';
$request->customerEmail = '[email protected]';
$request->customerAddress = 'Dhaka';
$request->customerCity = 'Dhaka';
$request->customerState = 'Dhaka';
$request->customerPostcode = '1209';
$request->customerCountry = 'Bangladesh';
$request->shippingAddress = 'Sirajganj';
$request->shippingCity = 'Dhaka';
$request->shippingCountry = 'Bangladesh';
$request->receivedPersonName = 'Jalil Mia';
$request->shippingPhoneNumber = '01712345678';
# Custom data can be sent using these value[1-4] fields which will be returned back to you in response. Any type of data can be passed on; e.g. string, integer, array etc.
$request->value1 = array("val1", "val2", "val3");
$request->value2 = 'value2';
$request->value3 = 'value3';
$request->value4 = 'value4';
$sp_instance->makePayment($request);
$sp_instance->verifyPayment($order_id);
shell
$ composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.