Python Wrapper for interacting with the Flutterwave Payments API
Project description
Python Flutterwave
Description
Python Wrapper for interacting with the Flutterwave API
Installation
pip install python-flutterwave
Usage
- Create an account in Flutterwave and obtain your
Secret Key
only.
from python_flutterwave import payment, initiate_payment
payment.token = 'YOUR_SECRET_KEY'
- To trigger a payment that returns a redirect uri
uri = payment.initiate_payment(tx_ref="qwerty", amount=100, redirect_url='your_callback_url',
payment_options='mpesa', customer_email='example@email.com',
customer_phone_number='0123456789', currency='KES', customer_name='John Doe',
title='Demo Payment', description='Just pay me...')
print(uri)
-
Redirect the user to that uri where he/she will make the payment.
-
After payment is made, the user will be redirected to the
redirect_url
you declared but Flutterwave will append some info regarding the payment i.e.transaction_id
andtx_ref
. If your url ishttps://example.com/callback
then it may behttp://example.com/callback/?status=successful&tx_ref=qwerty&transaction_id=2784792
-
You should save the transaction_id to your DB as it will be used to query the transaction details.
-
To check the transaction details e.g. successful or not, grab the transaction_id from the previous step.
details = payment.get_payment_details(transaction_id)
Project details
Release history Release notifications | RSS feed
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 python_flutterwave-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b761e30cd52d805550b3575f164bcc0b934d7424b4966d11b1af2cec17dc43b5 |
|
MD5 | 4b8edaf1f0f4b01f79a06b62bb223d60 |
|
BLAKE2b-256 | 0c535c368544baef3dd50110dbe36bced59e588587abb086a6c83ca64a8d4b99 |