Skip to content

The sp-plugin-typescript is a TypeScript-based plugin for integrating the shurjoPay payment gateway into your projects seamlessly. Designed for developers, this plugin provides a robust and easy-to-use interface to initiate and manage payment transactions using the shurjoPay platform.

License

Notifications You must be signed in to change notification settings

shurjopay-plugins/sp-plugin-typescript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

shurjoPay TypeScript plugin package

Made With NPM version

Official shurjoPay JavaScript package (plugin) for merchants or service providers to connect with shurjoPay Payment Gateway v2.1 developed and maintained by ShurjoMukhi Limited.

This plugin package is compatible with any TypeScript or JavaScript application or framework, including React, Vue.js, Angular, Next.js, and more. Also it makes it easy for developers to integrate with shurjoPay v2.1 with just three API calls:

  1. makePayment: create and send payment processing request
  2. verifyPayment: verify payment status at shurjoPay

Also reduces many of the things that you had to do manually

  • Handles http request and errors
  • JSON serialization and deserialization
  • Authentication during checkout and verification of payments

Audience

This document is intended for the developers and technical personnel of merchants and service providers who want to integrate the shurjoPay online payment gateway using javascript.

How to use this shurjoPay Plugin

To integrate the shurjoPay Payment Gateway in your JavaScript project do the following tasks sequentially.

Step 1: Copy and paste the lib folder from the plugin into the root directory of your project environment.

Step 2: Copy and paste the shurjopay_config.js file from the plugin into the root directory of your project environment.

Checkout this react project to see this plugin in action.

Step 3: Set up the configuration parameters correctly in the shurjopay_config.js file for the shurjopay plugin within your application.

e.g. SP_ENDPOINT Url, SP_USERNAME, SP_PASSWORD, SP_PREFIX for the order id and SP_RETURN_URL.

Create a shurjopay_config.js in the project directory with text similar like below:

const shurjopay_config = {
    SP_ENDPOINT: "https://sandbox.shurjopayment.com",
    SP_USERNAME: "sp_sandbox",
    SP_PASSWORD: "pyyk97hu&6u6",
    SP_PREFIX: "sp",
    SP_RETURN_URL: "https://<your.app.com>/shurjopay-response",
};

export { shurjopay_config };

To initiate a payment, import and use the makePayment function as follows:

import { makePayment } from "../lib/shurjoPay";

  const form_data = {
      prefix: "NOK",
      currency: "BDT",
      customer_name: "Md Wali Mosnad Ayshik",
      customer_phone: "01775XXXXXX",
      customer_email: "Ayshikmee@gmail.com",
      customer_address: "123 Street, Dhaka",
      customer_city: "Dhaka",
      customer_state: "Dhaka",
      customer_postcode: "1212",
      customer_country: "Bangladesh",
      shipping_address: "123 Street, Dhaka",
      shipping_city: "Dhaka",
      shipping_country: "Bangladesh",
      received_person_name: "Ayshik",
      shipping_phone_number: "017XXXXXXXX",
      amount: 100,
    };
      const merchantOrderId = `your order id`;
      const makePayment = await makePayment(merchantOrderId, form_data);

Payment verification can be done after each transaction with shurjopay order id

const verifyPayment_details = await verifyPayment(order_id as string);

References

  1. Next sample project showing usage of the javascript plugin.
  2. Vanilla javascript sample project to get your feet wet with shurjopay.
  3. Sample applications and projects in many different languages and frameworks showing shurjopay integration.
  4. shurjoPay Postman site illustrating the request and response flow using the sandbox system.
  5. shurjopay Plugins home page on github

License

This code is under the MIT open source License.

Please contact with shurjoPay team for more detail.

Copyright ©️2022 ShurjoMukhi Limited.

About

The sp-plugin-typescript is a TypeScript-based plugin for integrating the shurjoPay payment gateway into your projects seamlessly. Designed for developers, this plugin provides a robust and easy-to-use interface to initiate and manage payment transactions using the shurjoPay platform.

Resources

License

Stars

Watchers

Forks

Packages

No packages published