Skip to content

WorldxGrowth/razcrypto-python-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

RazCrypto Python SDK

Accept cryptocurrency payments (USDT, USDC, DAI) on BSC and Ethereum chains with ease using the official RazCrypto Python SDK.

Installation

pip install razcrypto
Quick Start
1. Initialize the Client
Python
from razcrypto import Client

client = Client("YOUR_GATEWAY_ID", "YOUR_SECRET_KEY")
2. Create a Payment
Python
try:
    payment = client.payment.create({
        "amount": 10.50,
        "currency": "USDT",
        "chain": "BSC",
        "email": "customer@example.com",
        "callback_url": "[https://yourwebsite.com/webhook](https://yourwebsite.com/webhook)",
        "custom_data": {
            "order_id": "ORD-12345"
        }
    })
    print("Checkout URL:", payment.get("checkout_page"))
    # Redirect your user to this URL
except Exception as e:
    print("Error:", str(e))
3. Verify Webhook (Flask Example)
Always verify the webhook signature to ensure security.

Python
from flask import Flask, request, jsonify
from razcrypto import Webhook

app = Flask(__name__)

@app.route('/webhook', methods=['POST'])
def webhook():
    signature = request.headers.get('X-RazCrypto-Signature', '')
    raw_payload = request.get_data() # Ensure this is raw bytes
    secret_key = "YOUR_SECRET_KEY"

    if Webhook.verify_signature(raw_payload, signature, secret_key):
        data = request.json
        if data.get('event') == 'payment.completed':
            order_id = data['custom_data'].get('order_id')
            # TODO: Mark order as paid in database
        return jsonify({"status": "ok"}), 200
    else:
        return jsonify({"error": "Invalid Signature"}), 401

About

razcrypto-python-sdk is tha sdk for python developer

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages