Skip to main content

Implements SSLCOMMERZ payment gateway in python based web apps.

Project description

SSLCOMMERZ Payment Gateway Python API

Downloads

Provides a python module to implement payment gateway in python based web apps.

Installation

Via PIP

pip install sslcommerz-python-api

or via git

pip install git+https://github.com/dreygur/SSLCommerz-Python.git

Projected use

#!usr/bin/env python

from decimal import Decimal
from sslcommerz_python_api import SSLCSession

mypayment = SSLCSession(
  sslc_is_sandbox=True,
  sslc_store_id='your_sslc_store_id',
  sslc_store_pass='your_sslc_store_passcode'
)

mypayment.set_urls(
  success_url='example.com/success',
  fail_url='example.com/failed',
  cancel_url='example.com/cancel',
  ipn_url='example.com/payment_notification'
)

mypayment.set_product_integration(
  total_amount=Decimal('20.20'),
  currency='BDT',
  product_category='clothing',
  product_name='demo-product',
  num_of_item=2,
  shipping_method='YES',
  product_profile='None'
)

mypayment.set_customer_info(
  name='John Doe',
  email='johndoe@email.com',
  address1='demo address',
  address2='demo address 2',
  city='Dhaka', postcode='1207',
  country='Bangladesh',
  phone='01711111111'
)

mypayment.set_shipping_info(
  shipping_to='demo customer',
  address='demo address',
  city='Dhaka',
  postcode='1209',
  country='Bangladesh'
)

# If you want to post some additional values
mypayment.set_additional_values(
  value_a='cusotmer@email.com',
  value_b='portalcustomerid',
  value_c='1234',
  value_d='uuid'
)

response_data = mypayment.init_payment()

# You can Print the response data
print(response_data)

Response parameters

When Successfull with Auth and Payloads provided

  • status
  • sessionkey
  • GatewayPageURL

Example

{'status': 'SUCCESS', 'sessionkey': 'F650E87F23DD2A8FFCB4E4E333C13B28', 'GatewayPageURL': 'https://sandbox.sslcommerz.com/EasyCheckOut/testcdef650e87f23dd2a8ffcb4234fasf3b28'}

or

>>> response_data['status']
SUCCESS
>>> response_data['sessionkey']
F650E87F23DD2A8FFCB4E4E333C13B28
>>> response_data['GatewayPageURL']
https://sandbox.sslcommerz.com/EasyCheckOut/testcdef650e87f23dd2a8ffcb4234fasf3b28

When Failed

  • status
  • failedreason

Example

{'status': 'FAILED', 'failedreason': 'Store Credential Error Or Store is De-active'}

or

>>> response_data['status']
FAILED
>>> response_data['failedreason']
'Store Credential Error Or Store is De-active'

Acknowledgemetns

It's a fork of Shahed Mehbub's sslcommerz-python

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

sslcommerz-python-api-0.0.7.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

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

sslcommerz_python_api-0.0.7-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file sslcommerz-python-api-0.0.7.tar.gz.

File metadata

  • Download URL: sslcommerz-python-api-0.0.7.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for sslcommerz-python-api-0.0.7.tar.gz
Algorithm Hash digest
SHA256 dc296b3ae7e432f229c204b15509f0de8a7678ba216f07630ba29ddf90c9fef9
MD5 46f8d5f312d298753920f6b9c79cfa37
BLAKE2b-256 a5023183e7d7606575eb7b5cb958efc0693e4b3a4ed171220542cd1d92785ce8

See more details on using hashes here.

File details

Details for the file sslcommerz_python_api-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: sslcommerz_python_api-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for sslcommerz_python_api-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ac7ff25c2f3e0798ca4129f28c38f4a14289810445807166a3305597bc4ce893
MD5 d7d7799800082c10cf37aeff2a006840
BLAKE2b-256 c96364b2800652f1bfcfeb884c2deebcdd6b89b252da126fd871c4248d317feb

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