### Create Payment Plan Example with Flutterwave Rave Python SDK Source: https://github.com/flutterwave/python-v2/blob/master/README.md Example of creating a payment plan using the `rave.PaymentPlan.create` method with specified amount, duration, name, and interval. ```python res = rave.PaymentPlan.create({ "amount": 1, "duration": 5, "name": "Ultimate Play", "interval": "5" }) print(res) ``` -------------------------------- ### Listing and Inspecting Nose Plugins Source: https://github.com/flutterwave/python-v2/blob/master/testing/lib/python3.10/site-packages/nose/usage.txt Provides commands to list all installed Nose plugins and to display more detailed information about each plugin, useful for verifying plugin installation and debugging. ```Shell nosetests --plugins ``` ```Shell nosetests --plugins -v ``` -------------------------------- ### Install Flutterwave Python Library Source: https://github.com/flutterwave/python-v2/blob/master/README.md Instructions to install the Flutterwave Python library using pip. ```Shell pip install rave_python ``` -------------------------------- ### Sample Response for Getting Account Balance Source: https://github.com/flutterwave/python-v2/blob/master/README.md Example of a successful JSON response when retrieving account balance, showing wallet details and available/ledger balances. ```APIDOC {'error': False, 'returnedData': {'status': 'success', 'message': 'WALLET-BALANCE', 'data': {'Id': 27122, 'ShortName': 'EUR', 'WalletNumber': '3855000502677', 'AvailableBalance': 0, 'LedgerBalance': 0}}} ``` -------------------------------- ### Example Getting Transfer Fees in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md Shows how to use the `rave.Transfer.getFee` method to retrieve transfer rates for a specific currency like EUR. ```python res2 = rave.Transfer.getFee("EUR") ``` -------------------------------- ### Complete Payment Plan Flow Example in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md This comprehensive example demonstrates initializing the Rave SDK and performing a complete payment plan flow, including creating a new plan and then editing an existing one. It also showcases robust error handling for various `RaveExceptions` such as `IncompletePaymentDetailsError`, `TransferFetchError`, and `ServerError`. ```python from rave_python import Rave, Misc, RaveExceptions rave = Rave("YOUR_PUBLIC_KEY", "YOUR_PRIVATE_KEY", usingEnv = False) try: res = rave.PaymentPlan.create({ "amount": 1, "duration": 5, "name": "Ultimate Plan", "interval": "dai" }) res = rave.PaymentPlan.edit(880, { "name": "Jack's Plan", "status": "active" }) print(res) except RaveExceptions.IncompletePaymentDetailsError as e: print(e) except RaveExceptions.TransferFetchError as e: print(e.err) except RaveExceptions.ServerError as e: print(e.err) ``` -------------------------------- ### Python: Create Virtual Account Example Source: https://github.com/flutterwave/python-v2/blob/master/README.md Demonstrates how to call the `rave.VirtualAccount.create` method with required `accountDetails` to create a virtual account. ```Python res = rave.VirtualAccount.create({ "email": "user@example.com", "bvn": "12345678901", "is_permanent": true, "narration": "Cornelius A-O" }) print(res) ``` -------------------------------- ### Example Rave BankTransfer Verify Call Source: https://github.com/flutterwave/python-v2/blob/master/README.md A Python example demonstrating how to call the `rave.BankTransfer.verify` method using a transaction reference obtained from a previous charge call. ```python res = rave.BankTransfer.verify(data["txRef"]) ``` -------------------------------- ### Complete Pre-authorization Charge Flow Example in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md This comprehensive example demonstrates the full pre-authorization charge flow, including initial charge, subsequent capture, and final transaction verification. It also illustrates robust error handling for `TransactionChargeError`, `PreauthCaptureError`, and `TransactionVerificationError`. ```python from rave_python import Rave, Misc, RaveExceptions rave = Rave("ENTER_YOUR_PUBLIC_KEY", "ENTER_YOUR_SECRET_KEY", usingEnv = False) # Payload with pin payload = { "token":"flw-t1nf-5b0f12d565cd961f73c51370b1340f1f-m03k", "country":"NG", "amount":1000, "email":"user@gmail.com", "firstname":"temi", "lastname":"Oyekole", "IP":"190.233.222.1", "txRef":"MC-7666-YU", "currency":"NGN", } try: res = rave.Preauth.charge(payload) res = rave.Preauth.capture(res["flwRef"]) res = rave.Preauth.verify(res["txRef"]) print(res) except RaveExceptions.TransactionChargeError as e: print(e) print(e.err["errMsg"]) print(e.err["flwRef"]) except RaveExceptions.PreauthCaptureError as e: print(e.err["errMsg"]) print(e.err["flwRef"]) except RaveExceptions.TransactionVerificationError as e: print(e.err["errMsg"]) print(e.err["txRef"]) ``` -------------------------------- ### Example: Calling rave.Card.refund in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md Provides a Python example of how to invoke the `rave.Card.refund` method, passing in the 'flwRef' obtained from a previous transaction response and the desired refund amount. ```Python res = rave.Card.refund(data["flwRef"], amount) ``` -------------------------------- ### Example Getting Account Balance in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md Shows how to use the `rave.Transfer.Balance` method to retrieve the account balance for a specific currency like EUR. ```python res2 = rave.Transfer.Balance("EUR") ``` -------------------------------- ### Sample Response for Getting Transfer Fees Source: https://github.com/flutterwave/python-v2/blob/master/README.md Example of a successful JSON response when retrieving transfer fees, showing details like fee type, currency, and amount. ```APIDOC {'error': False, 'returnedData': {'status': 'success', 'message': 'TRANSFER-FEES', 'data': [{'id': 6, 'fee_type': 'value', 'currency': 'EUR', 'fee': 35, 'createdAt': None, 'updatedAt': None, 'deletedAt': None, 'AccountId': 1}]}} ``` -------------------------------- ### Setuptools Egg-Info Writers Configuration Source: https://github.com/flutterwave/python-v2/blob/master/testing/lib/python3.10/site-packages/setuptools-65.5.0.dist-info/entry_points.txt Configures the functions responsible for writing metadata files within the `.egg-info` directory. These files contain crucial package information such as `PKG-INFO`, `entry_points.txt`, and `requires.txt`, essential for package distribution and installation. ```APIDOC [egg_info.writers] PKG-INFO = setuptools.command.egg_info:write_pkg_info dependency_links.txt = setuptools.command.egg_info:overwrite_arg depends.txt = setuptools.command.egg_info:warn_depends_obsolete eager_resources.txt = setuptools.command.egg_info:overwrite_arg entry_points.txt = setuptools.command.egg_info:write_entries namespace_packages.txt = setuptools.command.egg_info:overwrite_arg requires.txt = setuptools.command.egg_info:write_requirements top_level.txt = setuptools.command.egg_info:write_toplevel_names ``` -------------------------------- ### Python: Create Virtual Card Example Source: https://github.com/flutterwave/python-v2/blob/master/README.md Demonstrates how to call the `rave.VirtualCard.create` method with required `vcardDetails` to create a virtual card. ```Python res = rave.VirtualCard.create({ "currency": "NGN", "amount": "100", "billing_name": "Corvus james", "billing_address": "8, Providence Street", "billing_city": "Lekki", "billing_state": "Lagos", "billing_postal_code": "100001", "billing_country": "NG" }) print(res) ``` -------------------------------- ### Setuptools Distutils Commands Configuration Source: https://github.com/flutterwave/python-v2/blob/master/testing/lib/python3.10/site-packages/setuptools-65.5.0.dist-info/entry_points.txt Defines the mapping of standard distutils commands to their corresponding setuptools implementations. This allows setuptools to override or extend the default behavior of distutils commands like `install`, `build`, and `sdist`. ```APIDOC [distutils.commands] alias = setuptools.command.alias:alias bdist_egg = setuptools.command.bdist_egg:bdist_egg bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm build = setuptools.command.build:build build_clib = setuptools.command.build_clib:build_clib build_ext = setuptools.command.build_ext:build_ext build_py = setuptools.command.build_py:build_py develop = setuptools.command.develop:develop dist_info = setuptools.command.dist_info:dist_info easy_install = setuptools.command.easy_install:easy_install editable_wheel = setuptools.command.editable_wheel:editable_wheel egg_info = setuptools.command.egg_info:egg_info install = setuptools.command.install:install install_egg_info = setuptools.command.install_egg_info:install_egg_info install_lib = setuptools.command.install_lib:install_lib install_scripts = setuptools.command.install_scripts:install_scripts rotate = setuptools.command.rotate:rotate saveopts = setuptools.command.saveopts:saveopts sdist = setuptools.command.sdist:sdist setopt = setuptools.command.setopt:setopt test = setuptools.command.test:test upload_docs = setuptools.command.upload_docs:upload_docs ``` -------------------------------- ### Example Fetching All Transfers in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md Shows how to use the `rave.Transfer.all` method to retrieve all processed transfers. ```python res2 = rave.Transfer.all("") ``` -------------------------------- ### Example: Refunding a ZBMobile Transaction Source: https://github.com/flutterwave/python-v2/blob/master/README.md Illustrates how to initiate a refund for a ZBMobile transaction using its Flutterwave reference (`flwRef`) and the desired refund amount. ```py res = rave.ZBMobile.refund(data["flwRef"], amount) ``` -------------------------------- ### Setuptools Distutils Setup Keywords Configuration Source: https://github.com/flutterwave/python-v2/blob/master/testing/lib/python3.10/site-packages/setuptools-65.5.0.dist-info/entry_points.txt Specifies the validation functions for various keywords used in `setup.py` files. These keywords control aspects like package data inclusion, dependencies, entry points, and test suite configuration, ensuring proper usage and structure. ```APIDOC [distutils.setup_keywords] dependency_links = setuptools.dist:assert_string_list eager_resources = setuptools.dist:assert_string_list entry_points = setuptools.dist:check_entry_points exclude_package_data = setuptools.dist:check_package_data extras_require = setuptools.dist:check_extras include_package_data = setuptools.dist:assert_bool install_requires = setuptools.dist:check_requirements namespace_packages = setuptools.dist:check_nsp package_data = setuptools.dist:check_package_data packages = setuptools.dist:check_packages python_requires = setuptools.dist:check_specifier setup_requires = setuptools.dist:check_requirements test_loader = setuptools.dist:check_importable test_runner = setuptools.dist:check_importable test_suite = setuptools.dist:check_test_suite tests_require = setuptools.dist:check_requirements use_2to3 = setuptools.dist:invalid_unless_false zip_safe = setuptools.dist:assert_bool ``` -------------------------------- ### Example Rave Preauth Charge Call Source: https://github.com/flutterwave/python-v2/blob/master/README.md A Python example demonstrating how to call the `rave.Preauth.charge` method using a payload that includes a previously saved token, country, amount, email, and transaction reference. ```python payload = { "token":"flw-t1nf-5b0f12d565cd961f73c51370b1340f1f-m03k", "country":"NG", ``` -------------------------------- ### Setuptools Finalize Distribution Options Configuration Source: https://github.com/flutterwave/python-v2/blob/master/testing/lib/python3.10/site-packages/setuptools-65.5.0.dist-info/entry_points.txt Defines hooks that are called to finalize distribution options during the build process. This includes processing setup keywords and inheriting finalization logic from parent distributions, ensuring all options are correctly applied. ```APIDOC [setuptools.finalize_distribution_options] keywords = setuptools.dist:Distribution._finalize_setup_keywords parent_finalize = setuptools.dist:_Distribution.finalize_options ``` -------------------------------- ### Sample Response for Bulk Transfer Creation Source: https://github.com/flutterwave/python-v2/blob/master/README.md Example of a successful JSON response after initiating a bulk transfer, showing the status, message, and transfer details. ```APIDOC {'error': False, 'status': 'success', 'message': 'BULK-TRANSFER-CREATED', 'id': 499, 'data': {'id': 499, 'date_created': '2018-10-09T09:13:54.000Z', 'approver': 'N/A'}} ``` -------------------------------- ### Retrieve All Payment Plans Example with Flutterwave Rave Python SDK Source: https://github.com/flutterwave/python-v2/blob/master/README.md Example of retrieving all payment plans using the `rave.Transfer.all()` method. Note: The code snippet uses `rave.Transfer.all()` which might be a typo in the original documentation, as the context is `PaymentPlan`. ```python res2 = rave.Transfer.all() ``` -------------------------------- ### Define Distutils Command for nosetests Source: https://github.com/flutterwave/python-v2/blob/master/testing/lib/python3.10/site-packages/nose-1.3.7.dist-info/entry_points.txt This section registers `nosetests` as a command within Python's `distutils` (or `setuptools`) framework. This allows `nosetests` to be invoked as part of a package's setup or build process. ```Python [distutils.commands] nosetests = nose.commands:nosetests ``` -------------------------------- ### Sample Response for Fetching All Transfers Source: https://github.com/flutterwave/python-v2/blob/master/README.md Example of a successful JSON response when fetching all transfers, including pagination and a detailed list of transfer records. ```APIDOC {'error': False, 'returnedData': {'status': 'success', 'message': 'QUERIED-TRANSFERS', 'data': {'page_info': {'total': 19, 'current_page': 1, 'total_pages': 2}, 'transfers': [{'id': 2676, 'account_number': '0690000044', 'bank_code': '044', 'fullname': 'Mercedes Daniel', 'date_created': '2018-10-09T09:37:12.000Z', 'currency': 'NGN', 'debit_currency': None, 'amount': 500, 'fee': 45, 'status': 'PENDING', 'reference': 'MC-1539077832148', 'meta': None, 'narration': 'New transfer', 'approver': None, 'complete_message': '', 'requires_approval': 0, 'is_approved': 1, 'bank_name': 'ACCESS BANK NIGERIA'}, {'id': 2673, 'account_number': '0690000044', 'bank_code': '044', 'fullname': 'Mercedes Daniel', 'date_created': '2018-10-09T09:31:37.000Z', 'currency': 'NGN', 'debit_currency': None, 'amount': 500, 'fee': 45, 'status': 'FAILED', 'reference': 'MC-1539077498173', 'meta': None, 'narration': 'New transfer', 'approver': None, 'complete_message': 'DISBURSE FAILED: Insufficient funds', 'requires_approval': 0, 'is_approved': 1, 'bank_name': 'ACCESS BANK NIGERIA'}, {'id': 2672, 'account_number': '0690000034', 'bank_code': '044', 'fullname': 'Ade Bond', 'date_created': '2018-10-09T09:13:56.000Z', 'currency': 'NGN', 'debit_currency': None, 'amount': 500, 'fee': 45, 'status': 'FAILED', 'reference': None, 'meta': None, 'narration': 'Bulk transfer 2', 'approver': None, 'complete_message': 'DISBURSE FAILED: Insufficient funds', 'requires_approval': 0, 'is_approved': 1, 'bank_name': 'ACCESS BANK NIGERIA'}]}} ``` -------------------------------- ### Example: Verifying a ZBMobile Transaction Source: https://github.com/flutterwave/python-v2/blob/master/README.md Demonstrates how to call the `ZBMobile.verify` method with a transaction reference to check its status after a charge or validation. ```py res = rave.ZBMobile.verify(data["txRef"]) ``` -------------------------------- ### Complete SubAccount Creation and Fetch Flow in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md This comprehensive Python example illustrates the full lifecycle of SubAccount management, including initialization of the Rave client, creation of a new subaccount with specified details, and fetching an existing subaccount. It also demonstrates robust error handling for various `RaveExceptions`. ```python from rave_python import Rave, Misc, RaveExceptions rave = Rave("YOUR_PUBLIC_KEY", "YOUR_PRIVATE_KEY", usingEnv = False) try: res = rave.SubAccount.create({ "account_bank": "044", "account_number": "0690000032", "business_name": "Jake Stores", "business_email": "jdhhd@services.com", "business_contact": "Amy Parkers", "business_contact_mobile": "09083772", "business_mobile": "0188883882", "split_type": "flat", "split_value": 3000, "meta": [{"metaname": "MarketplaceID", "metavalue": "ggs-920900"}] }) res = rave.SubAccount.fetch('RS_0A6C260E1A70934DE6EF2F8CEE46BBB3') print(res) except RaveExceptions.IncompletePaymentDetailsError as e: print(e) except RaveExceptions.PlanStatusError as e: print(e.err) except RaveExceptions.ServerError as e: print(e.err) ``` -------------------------------- ### Python: Query All Virtual Cards Example Source: https://github.com/flutterwave/python-v2/blob/master/README.md Demonstrates how to call the `rave.VirtualCard.all` method to retrieve a list of all virtual cards associated with the account. ```Python res = rave.VirtualCard.all() print(res) ``` -------------------------------- ### Sample Response for Fetching Transfers Source: https://github.com/flutterwave/python-v2/blob/master/README.md Example of a successful JSON response when fetching transfers, including pagination information and a list of transfers. ```APIDOC {'error': False, 'returnedData': {'status': 'success', 'message': 'QUERIED-TRANSFERS', 'data': {'page_info': {'total': 0, 'current_page': 0, 'total_pages': 0}, 'transfers': []}}} ``` -------------------------------- ### International Transfer Meta Parameter Example Source: https://github.com/flutterwave/python-v2/blob/master/README.md This snippet provides an example of the `meta` parameter structure required for initiating international transfers. It specifies fields such as `AccountNumber`, `RoutingNumber`, `SwiftCode`, and `BeneficiaryCountry`. ```python "meta": [ { "AccountNumber": "09182972BH", "RoutingNumber": "0000000002993", "SwiftCode": "ABJG190", "BankName": "BANK OF AMERICA, N.A., SAN FRANCISCO, CA", "BeneficiaryName": "Mark Cuban", "BeneficiaryAddress": "San Francisco, 4 Newton", "BeneficiaryCountry": "US" } ] ``` -------------------------------- ### rave.Transfer.initiate(transferDetails) Method Source: https://github.com/flutterwave/python-v2/blob/master/README.md Documents the `.initiate` method of the `rave.Transfer` class, used to start a single transfer to a customer's account. It highlights the requirement for `beneficiary_name` and provides specific instructions for including a `meta` parameter for international transfers. ```APIDOC rave.Transfer.initiate(transferDetails): Description: Initiates a transfer to a customer's account. When a transfer is initiated, it comes with a status NEW this means the transfer has been queued for processing. Parameters: transferDetails: Object account_bank: string (required) account_number: string (required) amount: number (required) narration: string (optional) currency: string (required) beneficiary_name: string (required) meta: array (optional, for international transfers) - AccountNumber: string - RoutingNumber: string - SwiftCode: string - BankName: string - BeneficiaryName: string - BeneficiaryAddress: string - BeneficiaryCountry: string ``` -------------------------------- ### Git Commit Message Guidelines for Contributions Source: https://github.com/flutterwave/python-v2/blob/master/CONTRIBUTING.md This snippet illustrates the recommended format for Git commit messages when contributing to the Flutterwave Python library, including a concise summary and an optional detailed paragraph for larger changes. ```Shell $ git commit -m "A brief summary of the commit > > A paragraph describing what changed and its impact." ``` -------------------------------- ### Initiate Bulk Transfer in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md This Python example demonstrates how to use the `rave.Transfer.bulk` method to perform multiple transfers in a single call. It shows the structure for providing a title and an array of individual transfer details. ```python res2 = rave.Transfer.bulk({ "title":"May Staff Salary", "bulk_data":[ { "Ban":"044", "Account Number": "0690000032", "Amount":500, "Currency":"NGN", "Narration":"Bulk transfer 1", "reference": "mk-82973029" }, { "Bank":"044", "Account Number": "0690000034", "Amount":500, "Currency":"NGN", "Narration":"Bulk transfer 2", "reference": "mk-283874750" } ] }) ``` -------------------------------- ### Complete Transfer Flow Example (Python) Source: https://github.com/flutterwave/python-v2/blob/master/README.md Demonstrates a comprehensive transfer flow including initiating a single transfer, performing a bulk transfer, and retrieving the account balance. It also showcases robust error handling for various `RaveExceptions` such as `IncompletePaymentDetailsError`, `InitiateTransferError`, `TransferFetchError`, and `ServerError`. ```python from rave_python import Rave, RaveExceptions try: rave = Rave("ENTER_YOUR_PUBLIC_KEY", "ENTER_YOUR_SECRET_KEY", usingEnv = False) res = rave.Transfer.initiate({ "account_bank": "044", "account_number": "0690000044", "amount": 500, "narration": "New transfer", "currency": "NGN", "beneficiary_name": "Kwame Adew" }) res2 = rave.Transfer.bulk({ "title": "test", "bulk_data":[ ] }) print(res) balanceres = rave.Transfer.getBalance("NGN") print(balanceres) except RaveExceptions.IncompletePaymentDetailsError as e: print(e) except RaveExceptions.InitiateTransferError as e: print(e.err) except RaveExceptions.TransferFetchError as e: print(e.err) except RaveExceptions.ServerError as e: print(e.err) ``` -------------------------------- ### Example Fetching a Single Transfer in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md Shows how to use the `rave.Transfer.fetch` method to retrieve a specific transfer using its reference ID. ```python res2 = rave.Transfer.fetch("mk-82973029") ``` -------------------------------- ### Python Enaira Charge Method Sample Call Source: https://github.com/flutterwave/python-v2/blob/master/README.md A simple Python example demonstrating how to call the `rave.Enaira.charge` method with a `payload` dictionary to initiate an Enaira payment. ```Python res = rave.Enaira.charge(payload) ``` -------------------------------- ### Initiate Single Transfer in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md This Python example demonstrates how to use the `rave.Transfer.initiate` method to perform a single transfer. It includes essential parameters like `account_bank`, `account_number`, `amount`, `currency`, and `beneficiary_name`. ```python res = rave.Transfer.initiate({ "account_bank": "044", "account_number": "0690000044", "amount": 500, "narration": "New transfer", "currency": "NGN", "beneficiary_name": "Kwame Adew" }) print(res) ``` -------------------------------- ### Python BankTransfer Charge Method Sample Call Source: https://github.com/flutterwave/python-v2/blob/master/README.md A simple Python example demonstrating how to call the `rave.BankTransfer.charge` method with a `payload` dictionary to initiate a bank transfer payment. ```Python res = rave.BankTransfer.charge(payload) ``` -------------------------------- ### Python BankTransfer Verify Method Sample Call Source: https://github.com/flutterwave/python-v2/blob/master/README.md A concise Python example demonstrating how to use `rave.BankTransfer.verify` to check the status of a bank transfer transaction, passing the `txRef` obtained from the charge call. ```Python res = rave.BankTransfer.verify(data["txRef"]) ``` -------------------------------- ### Example: Charging a Francophone Mobile Money Transaction Source: https://github.com/flutterwave/python-v2/blob/master/README.md Shows a basic call to the `rave.Francophone.charge` method with a pre-defined payload to initiate a mobile money transaction in Francophone regions. ```py res = rave.Francophone.charge(payload) ``` -------------------------------- ### Sample Francophone Transaction Verification Call Source: https://github.com/flutterwave/python-v2/blob/master/README.md A Python example demonstrating how to call the `rave.Francophone.verify` method to check the status of a transaction using a previously obtained transaction reference. ```python res = rave.Francophone.verify(data["txRef"]) ``` -------------------------------- ### Sample Tanzanian Mobile Money Charge Call Source: https://github.com/flutterwave/python-v2/blob/master/README.md A Python example demonstrating how to call the `rave.TZSMobile.charge` method with a payload to initiate a Tanzanian mobile money transaction. ```python res = rave.TZSMobile.charge(payload) ``` -------------------------------- ### Initiate Account Transaction with Flutterwave Python SDK Source: https://github.com/flutterwave/python-v2/blob/master/README.md This section describes the `.charge(payload)` method used to start an account transaction. It details the required and optional parameters for the payload, explains the method's return value (a dictionary), and demonstrates how to handle `AccountChargeError` exceptions. ```APIDOC Method: .charge(payload) Description: Initiates an account transaction. Parameters: payload (dict): Dictionary containing payment information. amount (float/int): The transaction amount. Minimum N200 for NGN, 1 for GBP/EUR. currency (str): The currency. Supports NGN, GBP, EUR. email (str): Customer's email address. firstname (str): Customer's first name. lastname (str): Customer's last name. IP (str, optional): Customer's IP address. redirectUrl (str, optional): URL to redirect to after transaction. txRef (str, optional): Custom transaction reference. Automatically generated if not provided. Returns: dict validationRequired (bool): Indicates if further validation is needed. authUrl (str): URL for authentication if validation is required. flwRef (str): Flutterwave transaction reference. txRef (str): Your transaction reference. error (bool): True if an error occurred, False otherwise. Raises: AccountChargeError e.err (dict): Contains error details. errMsg (str): Error message. flwRef (str): Flutterwave reference (can be None). txRef (str): Your transaction reference. error (bool): True if an error occurred. ``` ```python res = rave.Account.charge(payload) ``` ```json { "validationRequired":True, "authUrl":"https://api.ravepay.co/flwv3-pug/getpaid/api/short-url/vHWOLuy89", "flwRef":"XINH44931689941420152189", "txRef":"MC-1689941418883", "error":False } ``` ```python try: #Your charge call except RaveExceptions.AccountChargeError as e: print(e.err["errMsg"]) print(e.err["flwRef"]) ``` ```json {'error': True, 'txRef': 'MC-1530897824739', 'flwRef': None, 'errMsg': 'Sorry, that account number is invalid, please check and try again'} ``` -------------------------------- ### Complete eNaira Charge and Verification Flow in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md A comprehensive Python example demonstrating the full eNaira charge and verification process. It includes initializing the Rave object, constructing the mobile payload, performing the charge and verify calls, and handling potential `TransactionChargeError` and `TransactionVerificationError` exceptions. ```python from rave_python import Rave, RaveExceptions, Misc rave = Rave("ENTER_YOUR_PUBLIC_KEY", "ENTER_YOUR_SECRET_KEY", usingEnv = False) # mobile payload payload = { "amount": 30, "PBFPubKey": "ENTER_YOUR_PUBLIC_KEY", "currency": "NGN", "email": "user@example.com", "meta": [{"metaname": "test", "metavalue": "12383"}], "ip": "123.0.1.3", "firstname": "Flutterwave", "lastname": "Tester", "is_token": False } try: res = rave.Enaira.charge(payload) res = rave.Enaira.verify(res["txRef"]) print(res) except RaveExceptions.TransactionChargeError as e: print(e.err) print(e.err["flwRef"]) except RaveExceptions.TransactionVerificationError as e: print(e.err["errMsg"]) print(e.err["txRef"]) ``` -------------------------------- ### Sample Tanzanian Mobile Money Charge Response Source: https://github.com/flutterwave/python-v2/blob/master/README.md An example of an empty dictionary returned after a successful Tanzanian mobile money charge call. The actual transaction details would be in the `res` object. ```python {} ``` -------------------------------- ### Complete ZBMobile Mobile Money Charge and Verification Flow Source: https://github.com/flutterwave/python-v2/blob/master/README.md Provides a full example of initializing the Rave SDK, constructing a mobile money payload, initiating a charge, verifying the transaction, and handling potential `TransactionChargeError` or `TransactionVerificationError` exceptions. ```py from rave_python import Rave, RaveExceptions, Misc rave = Rave("ENTER_YOUR_PUBLIC_KEY", "ENTER_YOUR_SECRET_KEY", usingEnv = False) # mobile payload payload = { "amount": "50", "email": "", "phonenumber": "xxxxxxxx", "redirect_url": "https://rave-webhook.herokuapp.com/receivepayment", "IP":"" } try: res = rave.ZBMobile.charge(payload) res = rave.ZBMobile.verify(res["txRef"]) print(res) except RaveExceptions.TransactionChargeError as e: print(e.err) print(e.err["flwRef"]) except RaveExceptions.TransactionVerificationError as e: print(e.err["errMsg"]) print(e.err["txRef"]) ``` -------------------------------- ### Complete Card Charge Flow with Error Handling in Python Source: https://github.com/flutterwave/python-v2/blob/master/README.md Presents a comprehensive Python example demonstrating a full card charge process. This includes initializing the Rave object, constructing a payment payload, handling suggested authentication (PIN/address), performing validation, verifying the transaction, and implementing robust error handling for `CardChargeError`, `TransactionValidationError`, and `TransactionVerificationError`. ```Python from rave_python import Rave, RaveExceptions, Misc rave = Rave("YOUR_PUBLIC_KEY", "YOUR_SECRET_KEY", usingEnv = False) # Payload with pin payload = { "cardno": "5438898014560229", "cvv": "890", "expirymonth": "09", "expiryyear": "19", "amount": "10", "email": "user@gmail.com", "phonenumber": "0902620185", "firstname": "temi", "lastname": "desola", "IP": "355426087298442", } try: res = rave.Card.charge(payload) if res["suggestedAuth"]: arg = Misc.getTypeOfArgsRequired(res["suggestedAuth"]) if arg == "pin": Misc.updatePayload(res["suggestedAuth"], payload, pin="3310") if arg == "address": Misc.updatePayload(res["suggestedAuth"], payload, address= {"billingzip": "07205", "billingcity": "Hillside", "billingaddress": "470 Mundet PI", "billingstate": "NJ", "billingcountry": "US"}) res = rave.Card.charge(payload) if res["validationRequired"]: rave.Card.validate(res["flwRef"], "") res = rave.Card.verify(res["txRef"]) print(res["transactionComplete"]) except RaveExceptions.CardChargeError as e: print(e.err["errMsg"]) print(e.err["flwRef"]) except RaveExceptions.TransactionValidationError as e: print(e.err) print(e.err["flwRef"]) except RaveExceptions.TransactionVerificationError as e: print(e.err["errMsg"]) print(e.err["txRef"]) ``` -------------------------------- ### Initiate Ugandan Mobile Money Transaction Source: https://github.com/flutterwave/python-v2/blob/master/README.md Starts a Ugandan mobile money transaction. Requires a payload with amount, email, phonenumber, IP, and redirect_url. Optionally accepts txRef for custom transaction references. Users must be redirected to the returned data.link to complete the charge. ```APIDOC UGMobile.charge(payload: dict) Description: Initiates a Ugandan mobile money transaction. Parameters: payload (dict): Dictionary containing payment information. amount (string): Transaction amount. email (string): User's email. phonenumber (string): User's phone number. IP (string): User's IP address. redirect_url (string): URL to redirect to after transaction. txRef (string, optional): Custom transaction reference. Returns: dict - A dictionary containing transaction status and data. Sample Response: { "status": "success", "message": "Momo initiated", "data": { "code": "02", "status": "pending", "ts": 1591798138846, "link": "https://ravemodal-dev.herokuapp.com/captcha/verify/123:49fa60c0db04f0017d717a0a662194cd" } } Raises: TransactionChargeError - If there was a problem processing the transaction. Sample e.err: {'error': True, 'txRef': 'MC-1530911537060', 'flwRef': None, 'errMsg': None} ``` ```python res = rave.UGMobile.charge(payload) ``` ```python try: #Your charge call except RaveExceptions.TransactionChargeError as e: print(e.err["errMsg"]) print(e.err["flwRef"]) ``` -------------------------------- ### Sample Francophone Mobile Money Charge Response Source: https://github.com/flutterwave/python-v2/blob/master/README.md An example dictionary returned after a successful Francophone mobile money charge call. It indicates whether validation is required and provides a redirect URL for authentication. ```python {'error': False, 'validationRequired': True, 'txRef': 'MC-1566482674756', 'flwRef': None, 'suggestedAuth': None, 'redirectUrl': 'https://flutterwaveprodv2.com/flwcinetpay/paymentServlet?reference=FLW186321566482674310'} ``` -------------------------------- ### Complete Tanzanian Mobile Money Charge and Verify Flow Source: https://github.com/flutterwave/python-v2/blob/master/README.md A comprehensive Python example demonstrating the full flow for Tanzanian mobile money transactions, including initializing the Rave object, constructing a payload, performing a charge, verifying the transaction, and handling both `TransactionChargeError` and `TransactionVerificationError`. ```python from rave_python import Rave, RaveExceptions, Misc rave = Rave("ENTER_YOUR_PUBLIC_KEY", "ENTER_YOUR_SECRET_KEY", usingEnv = False) # mobile payload payload = { "amount": "50", "email": "", "phonenumber": "054709929220", "redirect_url": "https://rave-webhook.herokuapp.com/receivepayment", "IP":"" } try: res = rave.TZSMobile.charge(payload) res = rave.TZSMobile.verify(res["txRef"]) print(res) except RaveExceptions.TransactionChargeError as e: print(e.err) print(e.err["flwRef"]) except RaveExceptions.TransactionVerificationError as e: print(e.err["errMsg"]) print(e.err["txRef"]) ``` -------------------------------- ### Initiate Zambian Mobile Money Transaction Source: https://github.com/flutterwave/python-v2/blob/master/README.md Starts a Zambian mobile money transaction. Requires a payload with amount, email, phonenumber, IP, and redirect_url. Optionally accepts txRef for custom transaction references. ```APIDOC ZBMobile.charge(payload: dict) Description: Initiates a Zambian mobile money transaction. Parameters: payload (dict): Dictionary containing payment information. amount (string): Transaction amount. email (string): User's email. phonenumber (string): User's phone number. IP (string): User's IP address. redirect_url (string): URL to redirect to after transaction. txRef (string, optional): Custom transaction reference. ``` ```python res = rave.ZBMobile.charge(payload) ``` -------------------------------- ### Complete Francophone Mobile Money Charge and Verify Flow Source: https://github.com/flutterwave/python-v2/blob/master/README.md A comprehensive Python example demonstrating the full flow for Francophone mobile money transactions, including initializing the Rave object, constructing a payload, performing a charge, verifying the transaction, and handling both `TransactionChargeError` and `TransactionVerificationError`. ```python from rave_python import Rave, RaveExceptions, Misc rave = Rave("ENTER_YOUR_PUBLIC_KEY", "ENTER_YOUR_SECRET_KEY", usingEnv = False) # mobile payload payload = { "amount": "50", "email": "", "phonenumber": "054709929220", "redirect_url": "https://rave-webhook.herokuapp.com/receivepayment", "IP":"" } try: res = rave.Francophone.charge(payload) print(res) res = rave.Francophone.verify(res["txRef"]) print(res) except RaveExceptions.TransactionChargeError as e: print(e.err) print(e.err["flwRef"]) except RaveExceptions.TransactionVerificationError as e: print(e.err["errMsg"]) print(e.err["txRef"]) ``` -------------------------------- ### Python Complete Bank Transfer Charge and Verification Flow Source: https://github.com/flutterwave/python-v2/blob/master/README.md Provides a comprehensive Python code example illustrating the full lifecycle of a bank transfer payment. This includes initializing the Rave object, constructing a payload, initiating the charge, verifying the transaction, and handling both `TransactionChargeError` and `TransactionVerificationError` exceptions. ```Python from rave_python import Rave, RaveExceptions, Misc rave = Rave("ENTER_YOUR_PUBLIC_KEY", "ENTER_YOUR_SECRET_KEY", usingEnv = False) # mobile payload payload = { "amount": "50", "email": "", "phonenumber": "054709929220", "redirect_url": "https://rave-webhook.herokuapp.com/receivepayment", "IP":"" } try: res = rave.BankTransfer.charge(payload) res = rave.BankTransfer.verify(res["txRef"]) print(res) except RaveExceptions.TransactionChargeError as e: print(e.err) print(e.err["flwRef"]) except RaveExceptions.TransactionVerificationError as e: print(e.err["errMsg"]) print(e.err["txRef"]) ``` -------------------------------- ### Define Console Scripts for nosetests Source: https://github.com/flutterwave/python-v2/blob/master/testing/lib/python3.10/site-packages/nose-1.3.7.dist-info/entry_points.txt This configuration section defines command-line entry points for `nosetests`, allowing it to be executed directly from the console. It includes a general entry and a specific one for Python 3.4 environments. ```Python [console_scripts] nosetests = nose:run_exit nosetests-3.4 = nose:run_exit ``` -------------------------------- ### Python: Sample Call to Create Subaccount Source: https://github.com/flutterwave/python-v2/blob/master/README.md Demonstrates how to call the `create` method with a dictionary of `accountDetails` to set up a new subaccount, including `split_type` and `split_value` for fee management. The `meta` field allows for additional custom data. ```Python res = rave.SubAccount.create({ "account_bank": "044", "account_number": "0690000031", "business_name": "Jake Stores", "business_email": "kwakj@services.com", "business_contact": "Amy Parkers", "business_contact_mobile": "09083772", "business_mobile": "0188883882", "split_type": "flat", "split_value": 3000, "meta": [{"metaname": "MarketplaceID", "metavalue": "ggs-920900"}] }) ``` -------------------------------- ### Configuring Nose via Configuration Files Source: https://github.com/flutterwave/python-v2/blob/master/testing/lib/python3.10/site-packages/nose/usage.txt Illustrates how to set Nose options in standard INI-style configuration files like `setup.cfg`, `.noserc`, or `nose.cfg`. Options are placed under a `[nosetests]` section. ```INI [nosetests] verbosity=3 with-doctest=1 ``` -------------------------------- ### Configuring Python Console Script Entry Points Source: https://github.com/flutterwave/python-v2/blob/master/testing/lib/python3.10/site-packages/pip-22.3.1.dist-info/entry_points.txt This snippet illustrates how console script entry points are typically defined in a Python project's configuration file (e.g., setup.cfg or pyproject.toml). It maps various 'pip' commands to the 'pip._internal.cli.main:main' function, allowing these commands to be executed directly from the system's command line. ```Python [console_scripts] pip = pip._internal.cli.main:main pip3 = pip._internal.cli.main:main pip3.10 = pip._internal.cli.main:main ``` -------------------------------- ### Python: Sample Response for All Subaccounts Source: https://github.com/flutterwave/python-v2/blob/master/README.md Illustrates the dictionary returned when retrieving all subaccounts, including `page_info` for pagination and a list of `subaccounts` with their detailed information. ```Python {'error': False, 'returnedData': {'status': 'success', 'message': 'SUBACCOUNTS', 'data': {'page_info': {'total': 3, 'current_page': 1, 'total_pages': 1}, 'subaccounts': [{'id': 114, 'account_number': '0690000032', 'account_bank': '044', 'business_name': 'Jake Stores', 'fullname': 'Pastor Bright', 'date_created': '2018-10-09T10:43:02.000Z', 'meta': [{'metaname': 'MarketplaceID', 'metavalue': 'ggs-920900'}], 'split_ratio': 1, 'split_type': 'flat', 'split_value': 3000, 'subaccount_id': 'RS_8279B1518A139DD3238328747F322418', 'bank_name': 'ACCESS BANK NIGERIA'}, {'id': 107, 'account_number': '0690000031', 'account_bank': '044', 'business_name': 'Jake Stores', 'fullname': 'Forrest Green', 'date_created': '2018-10-05T18:30:09.000Z', 'meta': [{'metaname': 'MarketplaceID', 'metavalue': 'ggs-920900'}], 'split_ratio': 1, 'split_type': 'flat', 'split_value': 100, 'subaccount_id': 'RS_41FFE616A1FA7EA56C85E57F593056F7', 'bank_name': 'ACCESS BANK NIGERIA'}]}}} ``` -------------------------------- ### Flutterwave Rave PaymentPlan.create Method API Source: https://github.com/flutterwave/python-v2/blob/master/README.md Detailed API documentation for creating a payment plan. It requires a dictionary `planDetails` with `amount`, `name`, `interval`, and `duration`. If `duration` is not passed, any subscribed customer will be charged indefinitely. ```APIDOC .create(planDetails) planDetails (dict): Dictionary containing plan details. amount (numeric): The amount for the plan. name (string): What would appear on the subscription reminder email. interval (string): Charge intervals. Possible values: daily, weekly, monthly, yearly, quarterly, bi-anually, every 2 days, every 90 days, every 5 weeks, every 12 months, every 6 years, every x y (where x is a number and y is the period e.g. every 5 months). duration (numeric, optional): The frequency. If set to 5 and intervals is set to monthly, you would be charged 5 months, and then the subscription stops. If not passed, charges indefinitely. Returns: dict Sample Response: {'error': False, 'id': 890, 'data': {'id': 890, 'name': 'Ultimate Play', 'amount': 1, 'interval': 'dai', 'duration': 5, 'status': 'active', 'currency': 'NGN', 'plan_token': 'rpp_af8ea4d5d785d08f47d8', 'date_created': '2018-10-09T10:03:00.000Z'}} Raises: RaveExceptions.IncompletePaymentDetailsError ``` -------------------------------- ### Handle PlanStatusError Exception (Python) Source: https://github.com/flutterwave/python-v2/blob/master/README.md Illustrates how to catch and handle `RaveExceptions.PlanStatusError`, which may be raised during subscription-related transactions. The example shows how to access the error message and Flutterwave reference from the exception. ```python try: #Your charge call except RaveExceptions.PlanStatusError as e: print(e.err["errMsg"]) print(e.err["flwRef"]) ``` -------------------------------- ### Sample Error Dictionary for Rave TransactionChargeError Source: https://github.com/flutterwave/python-v2/blob/master/README.md An example of the `e.err` dictionary content when a `TransactionChargeError` is raised, showing the error status, transaction reference, Flutterwave reference, and error message. ```python {'error': True, 'txRef': 'MC-1530911537060', 'flwRef': None, 'errMsg': None} ``` -------------------------------- ### Sample TransactionChargeError Object Structure Source: https://github.com/flutterwave/python-v2/blob/master/README.md An example of the `e.err` dictionary content when a `TransactionChargeError` is raised, providing details like error status, transaction reference, Flutterwave reference, and error message. ```json { "error":true, "txRef":"MC-1689940569118", "flwRef":None, "errMsg":None } ``` -------------------------------- ### Running Specific Python Tests with Nose Source: https://github.com/flutterwave/python-v2/blob/master/testing/lib/python3.10/site-packages/nose/usage.txt Demonstrates how to execute specific test files, modules, or even individual test cases and methods using the `nosetests` command line. This allows for targeted testing. ```Shell %prog only_test_this.py ``` ```Shell %prog test.module ``` ```Shell %prog another.test:TestCase.test_method ``` ```Shell %prog a.test:TestCase ``` ```Shell %prog /path/to/test/file.py:test_function ``` -------------------------------- ### rave.VirtualAccount.create Method API Reference Source: https://github.com/flutterwave/python-v2/blob/master/README.md Documentation for the `.create` method of the `rave.VirtualAccount` module. It details the required `accountDetails` dictionary parameters and the structure of the returned response, including potential errors. ```APIDOC .create(accountDetails) Parameters: accountDetails (dict): A dictionary containing the following keys: - email (string): User's email. - seckey (string): Secret key for authentication. - is_permanent (boolean): Indicates if the account is permanent. - frequency (string): Frequency of account usage (e.g., "N/A"). - bvn (string): Bank Verification Number. - duration (string): Duration for temporary accounts. - narration (string): Narration for the account. Returns: dict: A dictionary containing the status, message, and data of the created virtual account. Sample Response: { "status": "success", "message": "BANKTRANSFERS-ACCOUNTNUMBER-CREATED", "data": { "response_code": "02", "response_message": "Transaction in progress", "flw_reference": "FLW-89298329b9794587807aa775cda5db9f", "accountnumber": "1357960669", "accountstatus": "ACTIVE", "frequency": "N/A", "bankname": "Highstreet MFB", "created_on": "2019-08-20 12:18:46", "expiry_date": "N/A", "note": "Please make a bank transfer to Raver", "amount": null } } Raises: IncompleteAccountDetailsError: If there was a problem creating your virtual account. ``` -------------------------------- ### Python: Sample Call to Retrieve All Subaccounts Source: https://github.com/flutterwave/python-v2/blob/master/README.md Demonstrates how to call the `all` method on the `rave.SubAccount` object to fetch a list of all subaccounts without any parameters. ```Python res2 = rave.SubAccount.all() ```