Logo Lanfrica

Neurotech-HQ/snippe-python-sdk

Domain:

digital infrastructure

Record type:

softwaretools
Creator:
Neu
Host:
Official Python SDK for Snippe Payment API - Accept payments via mobile money, card, and QR code in East Africa. # Snippe Python SDK Official Python SDK for Snippe Payment API - Accept payments via mobile money, card, and QR code in East Africa. ## Installation ```bash pip install snippe ``` ## Quick Start ```python from snippe import Snippe, Customer client = Snippe("your_api_key") # Create a mobile money payment payment = client.create_mobile_payment( amount=1000, currency="TZS", phone_number="0788500000", customer=Customer(firstname="John", lastname="Doe"), ) print(f"Payment reference: {payment.reference}") print(f"Status: {payment.status}") ``` ## Payment Types ### Mobile Money (USSD Push) Customer receives a USSD prompt on their phone to confirm payment. ```python payment = client.create_mobile_payment( amount=5000, currency="TZS", phone_number="0712345678", customer=Customer( firstname="Jane", lastname="Doe", email="jane@example.com" # optional ), webhook_url="yourapp.com", # optional metadata={"order_id": "ORD-123"}, # optional ) ``` ### Card Payment Returns a `payment_url` to redirect the customer to complete payment. ```python payment = client.create_card_payment( amount=50000, currency="TZS", phone_number="0712345678", customer=Customer( firstname="John", lastname="Doe", email="john@example.com", address="123 Main Street", city="Dar es Salaam", state="DSM", postcode="14101", country="TZ", ), callback_url="yourapp.com", # required for card webhook_url="yourapp.com", ) # Redirect customer to this URL print(payment.payment_url) ``` ### QR Code Payment Returns a QR code for the customer to scan. ```python payment = client.create_qr_payment( amount=25000, currency="TZS", phone_number="0712345678", customer=Customer(firstname="John", lastname="Doe"), ) # Display this QR code to customer print(payment.payment_qr_code) print(payment.payment_token) ``` ## Check Payment Status ```python payment = client.get_payment("payment_reference") print(f"Status: {payment.status}") # pending, completed, fai …