A simple library to setup payment integration with CCAvenue
Project description
pay_ccavenue
A simple package to integrate CCAvenue. It can be used for both iframe
and seemless
methods.
How to install
pip install pay_ccavenue
Import
from pay_ccavenue import CCAvenue
Initialize the Package
We can either setup via the environment or by passing the credentials directly to the plugin.
Via the environment variables
Set the credentials in the environment variables
- Set
CCAVENUE_WORKING_KEY
for theWORKING_KEY
- Set
CCAVENUE_ACCESS_CODE
for theACCESS_CODE
- Set
CCAVENUE_MERCHANT_CODE
for theMERCHANT_CODE
- Set
CCAVENUE_REDIRECT_URL
for theREDIRECT_URL
- Set
CCAVENUE_CANCEL_URL
for theCANCEL_URL
And then instantiate the CCAvenue
object as shown below
ccavenue = CCAvenue()
Pasing the credentials directly
ccavenue = CCAvenue(WORKING_KEY, ACCESS_CODE, MERCHANT_CODE, REDIRECT_URL, CANCEL_URL)
NOTE
You don't need to explicitely pass WORKING_KEY
, ACCESS_CODE
, MERCHANT_CODE
, REDIRECT_URL
, CANCEL_URL
in the form data for any of the method i.e. Iframe
or seemless
.
To encrypt the data
form_data
is the post request body which is a dictionary of the related data for the payment. You don't need to pass the Merchant ID though. Since we have already intiated the package with the correct MERCHANT_CODE
. encrypt()
method return the encrypted string that can be ussed directly in the Iframe rendering.
encrypt_data = ccavenue.encrypt(form_data)
Pass the encrypt_data
from the above to the view to render the IFrame.
Decrypt the data received from the CCAvenue
form_data
is the post request body which is a dictionary of the related data received from the CCAvenue. The decrypt()
method returns the dictionary of the data received from the CCAvenue.
decrypted_data = ccavenue.decrypt(form_data)
Limitations
- I have not added any tests as of now in the package, but I have tested this out for my project after debugging their given examples and Stackoverflow to simplify it.
- More detailed documentation.
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
Built Distribution
Hashes for pay_ccavenue-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4415758cad7709a1d4015407da9a8bc03aa2f6bdd7f9b352c631ae628015d8e |
|
MD5 | 75ccdc9631c25458b465f2b7e31412ca |
|
BLAKE2b-256 | f3b4e8db599ef9708e7e51aa7291909326f4bfe3f960ef0ecb096ecdd18d68a7 |