Skip to main content

shurjopay version 2 payment gateway integration package for python users.

Project description

shurjoPay

ShurjoPay

shurjopay python integration steps

Prerequisite

To integrate ShurjoPay you need few credentials to access shurjopay:

:param prefix: Any string not more than 5 characters. It distinguishes the stores of a merchant.
:param currency: ISO format,(only BDT and USD are allowed).
:param return_url: Merchant should provide a GET Method return url to verify users initiated transaction status. 
:param cancel_url: Merchant should provide a cancel url to redirect the user if he/she cancels the transaction in midway. 
:param client_ip: User's ip
:param username: Merchant Username provided by shurjopay.
:param password: Merchant Password provided by shurjopay.
:param post_address: Live shurjopay version 2 URL.

📝 NOTE For shurjoPay version 2 live engine integration all necessary credential will be given to merchant after subscription completed on shurjoPay gateway.


Installation

Use the package manager pip to install Shuropay python package

pip install shurjopay-V2

To install Python package from github, you need to clone that repository.

git clone https://github.com/smukhidev/sp2-python.git

Then just run the setup.py file from that directory,

sudo python setup.py install

Usage

from shurjopay_v2.shurjopay import ShurjoPay

#initialize with the test credentials

testpay = shurjoPay.ShurjoPay(prefix="NOC", currency="BDT", return_url=[URL],cancel_url=[URL], client_ip=[IP],  username=[USERNAME], password=[PASSWORD], post_address=[SURJOPAY_URL])
testpay.checkout(1, "xyz123456789", "demo", "01682803595", "N/a", "dhaka")
testpay.check_status(order_id="NOC6188d03129212")

In return url controller to verify and get the sp order_id

from shurjopay_v2.shurjopay import ShurjoPay

#initialize with the test credentials

verifypayment = shurjoPay.ShurjoPay(prefix="NOC", currency="BDT", return_url=[URL],cancel_url=[URL], client_ip=[IP],  username=[USERNAME], password=[PASSWORD], post_address=[SURJOPAY_URL])
verifypayment.verify(order_id="NOC6188d03129212")

ShurjoPay

You can use the ShurjoPay class as an instance, within a class or by subclassing. The general usage flow is as follows:

  • Create a ShurjoPay instance with these parameters

    :param prefix: Any string not more than 5 characters. It distinguishes the stores of a merchant.
    :param currency: ISO format,(only BDT and USD are allowed).
    :param return_url: Merchant should provide a GET Method return url to verify users initiated transaction status. 
    :param cancel_url: Merchant should provide a cancel url to redirect the user if he/she cancels the transaction in midway. 
    :param client_ip: User's ip
    :param username: Merchant Username provided by shurjopay.
    :param password: Merchant Password provided by shurjopay.
    :param post_address: Live shurjopay version 2 URL.
    
    • Initialize the payment transaction with the checkout() functions
      • Arguments:
        :param amount: Transaction Amount [float] 
        :param order_id: Provide a Unique ORDER ID [string]
        :param customer_name: Customer Full Name [string]
        :param customer_phone: Customer Active Contact Number [string]
        :param customer_address: Customer Address [string]
        :param customer_city: Customer City [string]
        
      • Response : a JSON response with dynamic checkout_url will be provided. Example response
        { 
          'checkout_url': 'https://sandbox.securepay.shurjopayment.com/spaycheckout/?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvc2FuZGJveC5zaHVyam9wYXltZW50LmNvbVwvYXBpXC9sb2dpbiIsImlhdCI6MTYzNjM1MzYyMCwiZXhwIjoxNjM2MzU3MjIwLCJuYmYiOjE2MzYzNTM2MjAsImp0aSI6Ikt1MW1salZFQlBmaHdBRW8iLCJzdWIiOjEsInBydiI6IjgwNWYzOWVlZmNjNjhhZmQ5ODI1YjQxMjI3ZGFkMGEwNzZjNDk3OTMifQ.AVChXtT-g5De5OmenIucKvWF0PXx4x23PBjQFMsukJk&order_id=NOC6188d03129212',
          'amount': 1,
          'currency': 'BDT',
          'sp_order_id': 'NOC6188d03129212',
          'customer_order_id': 'xyz123456789',
          'customer_name': 'demo',
          'customer_address': 'N/a',
          'customer_city': 'dhaka',
          'customer_phone': '01682803595',
          'customer_email': None,
          'client_ip': '192.168.0.99',
          'intent': 'sale',
          'transactionStatus': 'Initiated'
        }
        
  • This ceckout_url will return an HTML shurjopay form you need to render this in your application for your users to complete the transaction.

    spform

  • After the transaction initialized customer action status will be sent through the return_url/cancel_url with a query string ?order_id=[SpOrderId] merchant should store the id for future use.

  • Use verify() to verify the transaction. This call is required only once for each transaction that initialized

    • Arguments:
    :param order_id: For verification, merchants must use order_id that is sent from shurjoPay during callback.
    
    • Response JSON
  • Use check_status() to check the customer transaction status.

    • Arguments:
    :param order_id:For transaction status, merchants must use order_id that is sent from shurjoPay during callback.
    
    • Response JSON

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shurjopay-V2-0.0.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shurjopay_V2-0.0.2-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file shurjopay-V2-0.0.2.tar.gz.

File metadata

  • Download URL: shurjopay-V2-0.0.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.15

File hashes

Hashes for shurjopay-V2-0.0.2.tar.gz
Algorithm Hash digest
SHA256 41fdc60b787ba2fc4d277b8be40398b52999907cbce53a967728997127e57050
MD5 e15a7c9732a8b7bfa3b896b572fab66d
BLAKE2b-256 e6623bbb771d242f2556fa58bfef2cc582794432efea0e6a055c90d8f3743af6

See more details on using hashes here.

File details

Details for the file shurjopay_V2-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: shurjopay_V2-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.15

File hashes

Hashes for shurjopay_V2-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b5d7d07992b353fb18b987a3b30e44b9f15514ae6d1dda068ce10d0ea87e9bec
MD5 e70780aa273d2298b1e7cc2cd96d7474
BLAKE2b-256 6b2b783bfca7a2cf7663ae6bd9acd025bf3e4b66fcad51e1b5aec84207c97f09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page