Skip to main content

Pallapay Python SDK to accept crypto currency payments.

Project description

Pallapay crypto payment gateway SDK

Easy to use SDK for pallapay crypto payment gateway, accept crypto in your website and get paid in cash.

Installation

pip install pallapay-python-sdk

Easy to use

First signup and create your API Key in pallapay website

Then you can create a payment link:

from pallapay.client import PallapayClient

api_key = "TEST_API_KEY"
secret_key = "TEST_API_KEY"

# Create payment link
pallapay_client = PallapayClient(apiKey=api_key, secret_key=secret_key)
created_payment = pallapay_client.create_payment(
    symbol="AED",
    amount="10",
    ipn_success_url="https://my_website.com/payment/success",
    ipn_failed_url="https://my_website.com/payment/failed",
    payer_email_address="johndoe@gmail.com",
    webhook_url="https://my_website.com/webhook",  # Optional
    payer_first_name="John",  # Optional
    payer_last_name="Doe",  # Optional
    note="YOUR CUSTOM NOTE",  # Optional
    order_id="YOUR_UNIQUE_ORDER_ID",  # Optional
)

print(created_payment.payment_link)
# Now you can redirect user to payment_link.

Handle Webhook

After user payment was done, we will call your WEBHOOK_URL. then you can validate the request and check if transaction was paid.

from pallapay.client import PallapayClient

def handle_webhook(request_body: dict):
    # Checking webhook request that pallapay will send to your WEBHOOK_URL

    api_key = "TEST_API_KEY"
    secret_key = "TEST_API_KEY"

    pallapay_client = PallapayClient(apiKey=api_key, secret_key=secret_key)
    webhook_data = pallapay_client.get_webhook_data(request_body=request_body)
    
    is_valid_webhook: bool = pallapay_client.is_valid_webhook_data(webhook_data=webhook_data)
    if is_valid_webhook:
        raise Exception("Invalid webhook data")
    
    is_paid = pallapay_client.is_paid_webhook_data(webhook_data=webhook_data)
    
    if is_paid:
        print('Successful Payment')
    else:
        print('Failed Payment')

Contribution

Contributions are highly appreciated either in the form of pull requests for new features, bug fixes or just bug reports.


Pallapay Website

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

pallapay_python_sdk-1.0.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

pallapay_python_sdk-1.0.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pallapay_python_sdk-1.0.0.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.8

File hashes

Hashes for pallapay_python_sdk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 34b218558d732f4d54c3d20e75c4bde2adad4ab6405ba93dd56e01d9ce1b81f3
MD5 ddd284f2a793cfcd0072fa8ee4939c0c
BLAKE2b-256 dad4b029108c1b8a85cdcc9d6644ef2845987a2311cb4ea66f86fa4810524943

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pallapay_python_sdk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a54d2cb1e8bc9e264b3b1d578aafdab24f4f6781fa831ee1e3fe622f5ea65432
MD5 262ce4b2b2efcc32c65589cbaad5e466
BLAKE2b-256 4af37a373ca6ac597948082b18ced3e3ab875cc442223e5651b850e34256c315

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