Skip to main content

A simple library to setup payment integration with CCAvenue

Project description

pay_ccavenue

A Python package for seamless integration with CCAvenue payment gateway.

Features

  • Easy-to-use API for CCAvenue integration
  • Secure encryption and decryption of payment data
  • Flexible configuration via environment variables or direct instantiation
  • Type hints for better code reliability

Current Limitations

  • This package does not yet support iframe integration with CCAvenue. It currently provides basic encryption and decryption functionality for standard integration.

Installation

Install the package using pip:

pip install pay_ccavenue

Quick Start

  1. Import the CCAvenue class:
from pay_ccavenue import CCAvenue
  1. Initialize the CCAvenue object:
# Using environment variables
ccavenue = CCAvenue()

# Or, passing credentials directly
ccavenue = CCAvenue(
    working_key="YOUR_WORKING_KEY",
    access_code="YOUR_ACCESS_CODE",
    merchant_code="YOUR_MERCHANT_CODE",
    redirect_url="YOUR_REDIRECT_URL",
    cancel_url="YOUR_CANCEL_URL"
)
  1. Encrypt payment data:
form_data = {
    "order_id": "123456",
    "amount": "1000.00",
    "currency": "INR",
    # Add other required fields
}

encrypted_data = ccavenue.encrypt(form_data)
  1. Decrypt response data:
response_data = {
    "encResp": "ENCRYPTED_RESPONSE_FROM_CCAVENUE"
}

decrypted_data = ccavenue.decrypt(response_data)

Configuration

Environment Variables

Set the following environment variables to configure the package:

  • CCAVENUE_WORKING_KEY: Your CCAvenue working key
  • CCAVENUE_ACCESS_CODE: Your CCAvenue access code
  • CCAVENUE_MERCHANT_CODE: Your CCAvenue merchant code
  • CCAVENUE_REDIRECT_URL: URL to redirect after successful payment
  • CCAVENUE_CANCEL_URL: URL to redirect after cancelled payment

Direct Instantiation

Pass the configuration parameters directly when creating the CCAvenue object:

ccavenue = CCAvenue(
    working_key="YOUR_WORKING_KEY",
    access_code="YOUR_ACCESS_CODE",
    merchant_code="YOUR_MERCHANT_CODE",
    redirect_url="YOUR_REDIRECT_URL",
    cancel_url="YOUR_CANCEL_URL"
)

API Reference

CCAvenue Class

Methods

  • encrypt(data: Dict[str, Any]) -> str: Encrypts the payment data
  • decrypt(data: Dict[str, str]) -> Dict[str, str]: Decrypts the response data

CCavenueFormData Class

Represents the form data required for CCAvenue payment processing. It includes mandatory and optional fields, and provides methods for data manipulation and validation.

Important Fields

  • merchant_id: CCAvenue merchant ID
  • order_id: Unique order identifier
  • currency: Payment currency (default: "INR")
  • amount: Payment amount
  • redirect_url: URL for successful payment redirection
  • cancel_url: URL for cancelled payment redirection

For a complete list of fields, refer to the CCavenueFormData class documentation.

Security Considerations

  • The package uses AES encryption with CBC mode for secure communication with CCAvenue.
  • Ensure that your working key and other sensitive information are kept secure and not exposed in your codebase.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Disclaimer

This package is not officially associated with CCAvenue. Use it at your own risk and ensure compliance with CCAvenue's terms of service.

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

pay_ccavenue-1.0.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

pay_ccavenue-1.0.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file pay_ccavenue-1.0.0.tar.gz.

File metadata

  • Download URL: pay_ccavenue-1.0.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.8.0-1014-azure

File hashes

Hashes for pay_ccavenue-1.0.0.tar.gz
Algorithm Hash digest
SHA256 51a663cd792a5c9786754b1e472445c2eb926f4e49ecb5d00b70998234e3c9c1
MD5 b56ea398b7709a9b7d7fbb5f61b2a8c1
BLAKE2b-256 4eb9b069ea11a0bfd08c33375adbe732631d03cafe1f3a21181d7de554c3a71e

See more details on using hashes here.

File details

Details for the file pay_ccavenue-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: pay_ccavenue-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.1 Linux/6.8.0-1014-azure

File hashes

Hashes for pay_ccavenue-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec8c08759df1ba70abdd2ed33691d9a6a6956c5a392f67625f3b50c5c4de0156
MD5 df4d4ddd99b149aa87988c985ec784b4
BLAKE2b-256 c81fcd0636f0845f3ab2dbc06cae1697b93dd4a8da2bf4e871a31ba34761a440

See more details on using hashes here.

Supported by

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