- Collections: Card, Account, Mobile money, Bank Transfers, USSD, Barter, NQR.
- Payouts and Beneficiaries.
- Recurring payments: Tokenization and Subscriptions.
- Split payments
- Card issuing
- Transactions dispute management: Refunds.
- Transaction reporting: Collections, Payouts, Settlements, and Refunds.
- Bill payments: Airtime, Data bundle, Cable, Power, Toll, E-bills, and Remitta.
- Identity verification: Resolve bank account, resolve BVN information.
Table of Contents
- Requirements
- Installation
- Initialization
- Usage
- Testing
- Debugging Errors
- Support
- Contribution guidelines
- License
- Changelog
Requirements
- Flutterwave for business API Keys
- Supported Python versions: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
Installation
To install the library, runInitialization
Import Package
The base class for this package is ‘Rave’. To use this class, add:To instantiate in sandbox:
To use Rave, instantiate the Rave class with your public key. We recommend that you store your secret key in an environment variable named,RAVE_SECRET_KEY. Instantiating your rave object is therefore as simple as:
To instantiate without environment variables (Sandbox):
If you choose not to store your secret key in an environment variable, we do provide ausingEnv flag which can be set to False, but please be warned, do not use this package without environment variables in production
To instantiate in production:
To initialize in production, simply set theproduction flag to True. It is highly discouraged but if you choose to not use environment variables, you can do so in the same way mentioned above.
Usage
This is the documentation for all of the components of rave_pythonrave.Card
This is used to facilitate card transactions.
Functions included:
-
.charge -
.validate -
.verify -
.refund -
.getTypeOfArgsRequired -
.updatePayload
.charge(payload)
This is called to start a card transaction. The payload should be a dictionary containing card information. It should have the parameters:
-
cardno, -
cvv, -
currency, -
country, -
expirymonth, -
expiryyear, -
amount, -
email, -
phonenumber, -
firstname, -
lastname, -
IP
txRef parameter. Note that if you do not specify one, it would be automatically generated. We do provide a function for generating transaction references in the Misc library.
A sample call is:
Returns
This call returns a dictionary. A sample response is:CardChargeError if there was a problem processing your transaction. The CardChargeError contains some information about your transaction. You can handle this as such:
e.err contains:
rave.Misc.updatePayload(authMethod, payload, arg)
Depending on the suggestedAuth from the charge call, you may need to update the payload with a pin or address. To know which type of authentication you would require, simply call rave.Card.getTypeOfArgsRequired(suggestedAuth). This returns either pin or address.
In the case of pin, you are required to call rave.Card.updatePayload(suggestedAuth, payload, pin="THE_CUSTOMER_PIN").
In the case of address, you are required to call rave.Card.updatePayload(suggestedAuth, payload, address={ THE_ADDRESS_DICTIONARY })
A typical address dictionary includes the following parameters:
billingzip,
billingcity,
billingaddress,
billingstate,
billingcountry
Note:
suggestedAuth is the suggestedAuth returned from the initial charge call and payload is the original payload
.validate(txRef)
After a successful charge, most times you will be asked to verify with OTP. To check if this is required, check the validationRequired key in the res of the charge call.
To validate, you need to pass the flwRef from the res of the charge call as well as the OTP.
A sample validate call is:
Returns
This call returns a dictionary containing thetxRef, flwRef among others if successful.
This call raises a TransactionValidationError if the OTP is not correct or there was a problem processing your request.
To handle this, write:
e.err contains:
.verify(txRef)
You can call this to check if your transaction was completed successfully. You have to pass the transaction reference generated at the point of charging. This is the txRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withtxRef, flwRef and transactionComplete which indicates whether the transaction was completed successfully.
Sample
Please note that after charging a card successfully on rave, if you wish to save the card for further charges, in your verify payment response you will find an object: "cardtoken": "flw-t0-f6f915f53a094671d98560272572993e-m03k". This is the token you will use for card tokenization. Details are provided below.
If your call could not be completed successfully, a TransactionVerificationError is raised.
.charge(payload_for_saved_card, chargeWithToken=True)
This is called to start a card transaction with a card that has been saved. The payload should be a dictionary containing card information. It should have the parameters:
-
token, -
country, -
amount, -
email, -
firstname, -
lastname, -
IP, -
txRef, -
currency
NB: email must be the same as before the card was saved
Optionally, you can add a custom transaction reference using thetxRef parameter. Note that if you do not specify one, it would be automatically generated. We do provide a function for generating transaction references in the Misc library.
A sample call is:
Returns
This call returns a dictionary. A sample response is:CardChargeError if a wrong token or email is passed or if there was a problem processing your transaction. The CardChargeError contains some information about your transaction. You can handle this as such:
IncompletePaymentDetailsError if any of the required parameters are missing. The IncompletePaymentDetailsError contains information about which parameter was not included in the payload. You can handle this such as:
rave.Card.verify passing in the txRef returned in the response to verify the payment. Sample response:
rave.Card.verify raises a TransactionVerificationError if an invalid txRef is supplied. You can handle this as such:
NB: when charging saved cards, you do not need to call rave.card.Validate()
.refund(flwRef, amount)
You can call this to refund a full or partial amount of a transaction that was completed successfully. You have to pass the flw reference generated at the point of verifing the transaction. This is the flwRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withstatus, AmountRefunded, disburse_ref and disburse_status which indicates whether the transaction was completed successfully.
Sample
Complete card charge flow
rave.Account This is used to facilitate account transactions.
Transactions initiated via this method are authorized by the user on their
Banking platform.
Functions included:
.charge.verify
.charge(payload)
This is called to start an account transaction. The payload should be a dictionary containing payment information. It should have the parameters:
amount(The min amount for NGN account payments is N200. For GBP and EUR payments, the min amount is 1),currency(This payment option supports NGN, GBP and EUR),email,firstname,lastname,IP(optional)redirectUrl(optional)
txRef parameter. Note that if you do not specify one, it would be automatically generated. We do provide a function for generating transaction references in the Misc library.
A sample call is:
Returns
This call returns a dictionary. A sample response is:AccountChargeError if there was a problem processing your transaction. The AccountChargeError contains some information about your transaction. You can handle this as such:
e.err contains:
.verify(txRef)
You can call this to check if your transaction was completed successfully. You have to pass the transaction reference generated at the point of charging. This is the txRef in the res parameter returned any the chargecall.
A sample verify call is:
Returns
This call returns a dict withtxRef, flwRef and transactionComplete which indicates whether the transaction was completed successfully.
Sample
txRef is passed, a TransactionVerificationError is raised. You can handle that as such
.refund(flwRef, amount)
You can call this to refund a full or partial amount of a transaction that was completed successfully. You have to pass the flw reference generated at the point of verifing the transaction. This is the flwRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withstatus, AmountRefunded, disburse_ref and disburse_status which indicates whether the transaction was completed successfully.
Sample
Complete account flow
rave.GhMobile
This is used to facilitate Ghanaian mobile money transactions.
Functions included:
-
.charge -
.verify
.charge(payload)
This is called to start a Ghana mobile money transaction. The payload should be a dictionary containing payment information. It should have the parameters:
-
amount, -
email, -
phonenumber, -
network, -
IP, -
redirect_url
txRef parameter. Note that if you do not specify one, it would be automatically generated. We do provide a function for generating transaction references in the Misc library.
A sample call is:
Returns
This call returns a dictionary. A sample response is:data.link from the charge response.
This call raises a TransactionChargeError if there was a problem processing your transaction. The TransactionChargeError contains some information about your transaction. You can handle this as such:
e.err contains:
.verify(txRef)
You can call this to check if your transaction was completed successfully. You have to pass the transaction reference generated at the point of charging. This is the txRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withtxRef, flwRef and transactionComplete which indicates whether the transaction was completed successfully.
If your call could not be completed successfully, a TransactionVerificationError is raised.
.refund(flwRef, amount)
You can call this to refund a full or partial amount of a transaction that was completed successfully. You have to pass the flw reference generated at the point of verifing the transaction. This is the flwRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withstatus, AmountRefunded, disburse_ref and disburse_status which indicates whether the transaction was completed successfully.
Sample
Complete GhMobile charge flow
rave.Mpesa
This is used to facilitate Mpesa transactions.
Functions included:
-
.charge -
.verify
.charge(payload)
This is called to start an Mpesa transaction. The payload should be a dictionary containing payment information. It should have the parameters:
-
amount, -
email, -
phonenumber, -
IP
txRef parameter. Note that if you do not specify one, it would be automatically generated. We do provide a function for generating transaction references in the Misc library.
A sample call is:
Returns
This call returns a dictionary. A sample response is:TransactionChargeError if there was a problem processing your transaction. The TransactionChargeError contains some information about your transaction. You can handle this as such:
e.err contains:
.verify(txRef)
You can call this to check if your transaction was completed successfully. You have to pass the transaction reference generated at the point of charging. This is the txRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withtxRef, flwRef and transactionComplete which indicates whether the transaction was completed successfully.
If your call could not be completed successfully, a TransactionVerificationError is raised.
.refund(flwRef, amount)
You can call this to refund a full or partial amount of a transaction that was completed successfully. You have to pass the flw reference generated at the point of verifing the transaction. This is the flwRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withstatus, AmountRefunded, disburse_ref and disburse_status which indicates whether the transaction was completed successfully.
Sample
Complete Mpesa charge flow
rave.UGMobile
This is used to facilitate Uganda mobile money transactions.
Functions included:
-
.charge -
.verify
.charge(payload)
This is called to start a Ugandan mobile money transaction. The payload should be a dictionary containing payment information. It should have the parameters:
-
amount, -
email, -
phonenumber, -
IP, -
redirect_url
txRef parameter. Note that if you do not specify one, it would be automatically generated. We do provide a function for generating transaction references in the Misc library.
A sample call is:
Returns
This call returns a dictionary. A sample response is:data.link from the charge response.
This call raises a TransactionChargeError if there was a problem processing your transaction. The TransactionChargeError contains some information about your transaction. You can handle this as such:
e.err contains:
.verify(txRef)
You can call this to check if your transaction was completed successfully. You have to pass the transaction reference generated at the point of charging. This is the txRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withtxRef, flwRef and transactionComplete which indicates whether the transaction was completed successfully.
If your call could not be completed successfully, a TransactionVerificationError is raised.
.refund(flwRef, amount)
You can call this to refund a full or partial amount of a transaction that was completed successfully. You have to pass the flw reference generated at the point of verifing the transaction. This is the flwRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withstatus, AmountRefunded, disburse_ref and disburse_status which indicates whether the transaction was completed successfully.
Sample
Complete UGMobile charge flow
rave.ZBMobile
This is used to facilitate Zambian mobile money transactions.
Functions included:
-
.charge -
.verify
.charge(payload)
This is called to start a Zambian mobile money transaction. The payload should be a dictionary containing payment information. It should have the parameters:
-
amount, -
email, -
phonenumber, -
IP, -
redirect_url
txRef parameter. Note that if you do not specify one, it would be automatically generated. We do provide a function for generating transaction references in the Misc library.
A sample call is:
Returns
This call returns a dictionary. A sample response is:data.link from the charge response.
This call raises a TransactionChargeError if there was a problem processing your transaction. The TransactionChargeError contains some information about your transaction. You can handle this as such:
e.err contains:
.verify(txRef)
You can call this to check if your transaction was completed successfully. You have to pass the transaction reference generated at the point of charging. This is the txRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withtxRef, flwRef and transactionComplete which indicates whether the transaction was completed successfully.
If your call could not be completed successfully, a TransactionVerificationError is raised.
.refund(flwRef, amount)
You can call this to refund a full or partial amount of a transaction that was completed successfully. You have to pass the flw reference generated at the point of verifing the transaction. This is the flwRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withstatus, AmountRefunded, disburse_ref and disburse_status which indicates whether the transaction was completed successfully.
Sample
Complete ZBMobile charge flow
rave.Francophone
This is used to facilitate mobile money transactions in Ivory Coast, Senegal and Mali.
Functions included:
-
.charge -
.verify
.charge(payload)
This is called to start a francophone mobile money transaction. The payload should be a dictionary containing payment information. It should have the parameters:
-
amount, -
email, -
phonenumber, -
IP, -
redirect_url
txRef parameter. Note that if you do not specify one, it would be automatically generated. We do provide a function for generating transaction references in the Misc library.
A sample call is:
Returns
This call returns a dictionary. A sample response is:'redirectUrl':'https://redirecturl.com' for the authentication of the transaction. It raises a TransactionChargeError if there was a problem processing your transaction. The TransactionChargeError contains some information about your transaction. You can handle this as such:
e.err contains:
.verify(txRef)
You can call this to check if your transaction was completed successfully. You have to pass the transaction reference generated at the point of charging. This is the txRef in the res parameter returned any of the calls (charge or validate).
A sample verify call is:
Returns
This call returns a dict withtxRef, flwRef and transactionComplete which indicates whether the transaction was completed successfully.
If your call could not be completed successfully, a TransactionVerificationError is raised.
Complete Francophone mobile money charge flow
rave.TZSMobile
This is used to collect Tanzanian mobile money collections.
Functions included:
-
.charge -
.verify
.charge(payload)
This is called to start a Tanzanian mobile money transaction. The payload should be a dictionary containing payment information. It should have the parameters:
-
amount, -
email, -
phonenumber, -
IP(optional), -
redirect_url(optional)
txRef parameter. Note that if you do not specify one, it would be automatically generated. We do provide a function for generating transaction references in the Misc library.
A sample call is:
Returns
This call returns a dictionary. A sample response is:TransactionChargeError if there was a problem processing your transaction. The TransactionChargeError contains some information about your transaction. You can handle this as such:
e.err contains:
.verify(txRef)
You can call this to check if your transaction was completed successfully. You have to pass the transaction reference generated at the point of charging. This is the txRef in the res parameter returned in the charge call.
A sample verify call is:
Returns
This call returns a dict withtxRef, flwRef and transactionComplete which indicates whether the transaction was completed successfully.
If your call could not be completed successfully, a TransactionVerificationError is raised.
Complete Tanzania mobile money charge flow
rave.BankTransfer
This is used to create a virtual account for a Bank transfer payment.
Functions included:
.charge.verify
.charge(payload)
This is called to initiate the Bank transfer payment. The payload should be a dictionary containing payment information. It should have the parameters:
amount,email,firstname,lastname,phonenumber(optional),IP(optional),redirect_url(optional)
txRef parameter. Note that if you do not specify one, it would be automatically generated. We do provide a function for generating transaction references in the Misc library.
A sample call is:
Returns
This call returns a dictionary. A sample response is:TransactionChargeError if there was a problem processing your transaction. The TransactionChargeError contains some information about your transaction. You can handle this as such:
e.err contains:
.verify(txRef)
You can call this to check if your transaction was completed successfully. You have to pass the transaction reference generated at the point of charging. This is the txRef in the res parameter returned in the charge call.
A sample verify call is:
Returns
This call returns a dict withtxRef, flwRef and transactionComplete which indicates whether the transaction was completed successfully.
If your call could not be completed successfully, a TransactionVerificationError is raised.
Complete Bank Transfer charge flow
===
rave.Enaira
This is used to create Enaira wallet payments.
Functions included:
.charge.verify
.charge(payload)
This is called to initiate the Enaira payment. The payload should be a dictionary containing payment information. It should have the parameters:
amount,email,firstname,lastname,ìs_token,phonenumber(optional),IP(optional),redirect_url(optional)
txRef parameter. Note that if you do not specify one, it would be automatically generated. We do provide a function for generating transaction references in the Misc library.
A sample call is:
Returns
This call returns a dictionary. A sample response is:TransactionChargeError if there was a problem processing your transaction. The TransactionChargeError contains some information about your transaction. You can handle this as such:
e.err contains:
.verify(txRef)
You can call this to check if your transaction was completed successfully. You have to pass the transaction reference generated at the point of charging. This is the txRef in the res parameter returned in the charge call.
A sample verify call is:
Returns
This call returns a dict withtxRef, flwRef and transactionComplete which indicates whether the transaction was completed successfully.
If your call could not be completed successfully, a TransactionVerificationError is raised.
Complete Enaira charge flow
rave.Preauth
This is used to facilitate preauthorized card transactions. This inherits the Card class so any task you can do on Card, you can do with preauth.
Functions included:
-
.charge -
.capture -
.validate -
.verify -
.refund -
.void
** In order to
preauthorize a card, you must have: 1. charged the card initially using rave.Card.charge(payload) 2. saved the token returned to you for that card. A token looks like this flw-t1nf-5b0f12d565cd961f73c51370b1340f1f-m03k
**
.charge(cardDetails, chargeWithToken=True, hasFailed=False)
This is used to preauthorize a specific amount to be paid by a customer.
Note: > it takes the same parameters as Card charge. However, the cardDetails object differs. See below for an example
Once preauthorized successfully, you can then capture that held amount at a later time or date
A sample charge call is:
Returns
This call returns a dictionary. A sample response is:TransactionChargeError if there was a problem processing your transaction. The TransactionChargeError contains some information about your transaction. You can handle this as such:
.capture(flwRef)
This is used to capture the funds held in the account. Similar to the validate call, it requires you to pass the flwRef of the transaction.
Please NOTE that theA sample capture call is:flwRefmust be gotten from the response of the initial charge i.e after callingrave.Preauth.charge(payload)
Returns
This call returns a dictionary. A sample response is:PreauthCaptureError if there was a problem processing your transaction. The PreauthCaptureError contains some information about your transaction. You can handle this as such:
.void(flwRef)
This is used to void a preauth transaction. Similar to the validate call, it requires you to pass the flwRef.
Please NOTE that theA sample void call is:flwRefmust be gotten from the response of the initial charge i.e after callingrave.Preauth.charge(payload)
.refund(flwRef)
This is used to refund a preauth transaction. Similar to the validate call, it requires you to pass the flwRef.
Please NOTE that theA sample void call is:flwRefmust be gotten from the response of the initial charge i.e after callingrave.Preauth.charge(payload)
.verify(txRef)
See rave.Card.verify above
Returns
This call returns a dictionary. A sample response is:TransactionVerificationError if there was a problem processing your transaction. The TransactionVerificationError contains some information about your transaction. You can handle this as such:
Complete preauth charge flow
rave.SubAccount
This is used to initiate and manage payouts
Functions included:
-
.create -
.all -
.fetch -
.edit -
.cancel
.create(accountDetails)
This allows you to create a subaccount plan. It requires a dict accountDetails containing account_bank, account_number, business_name, business_email, business_contact, business_contact_mobile, business_mobile.
account_bank: This is the sub-accounts bank ISO code, use the List of Banks for Transfer endpoint to retrieve a list of bank codes.
account_number: This is the customer’s account number
business_name: This is the sub-account business name.
business_email: This is the sub-account business email.
business_contact: This is the contact person for the sub-account e.g. Richard Hendrix
business_contact_mobile: Business contact number.
business_mobile: Primary business contact number.
split_type: This can be set aspercentageorflatwhen set as percentage it means you want to take a percentage fee on all transactions, and vice versa for flat this means you want to take a flat fee on every transaction.
split_value: This can be aMore information can be found here A sample create call is:percentagevalue orflatvalue depending on what was set onsplit_type
Returns
This call returns a dictionary. A sample response is:.SubaccountCreationError if there was a problem processing your transaction. The .SubaccountCreationError contains some information about your transaction. You can handle this as such:
.all()
This allows you retrieve all subaccounts
A sample all Subaccounts call is:
Returns
This call returns a dictionary. A sample response is:PlanStatusError if there was a problem processing your transaction. The PlanStatusError contains some information about your transaction. You can handle this as such:
.fetch(subaccount_id)
This allows you fetch a subaccount. You may or may not pass in a subaccount_id. If you do not pass in a subaccount_id all subacocunts will be returned.
subaccount_id: This is the payment plan ID. It can be gotten from the response returned from creating a plan or from the Rave DashboardA sample fetch Subaccount call is:
Returns
This call returns a dictionary. A sample response is:PlanStatusError if there was a problem processing your transaction. The PlanStatusError contains some information about your transaction. You can handle this as such:
Complete SubAccount flow
rave.Transfer
This is used to initiate and manage payouts
Functions included:
-
.initiate -
.bulk -
.fetch -
.all -
.getFee -
.getBalance
.retryTransfer
*fetchRetries
.initiate(transferDetails)
This 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.
Please note that you must pass beneficiary_name as part of the initiate call. Else an error will be thrown.
Also, if you are doing international transfers, you must pass a meta parameter as part of your payload as shown below:
Returns
This call returns a dictionary. A sample response is:IncompletePaymentDetailsError if there was a problem processing your transaction. The IncompletePaymentDetailsError contains some information about your transaction. You can handle this as such:
.bulk(bulkDetails)
This initiates a bulk transfer to the customers specified in the bulkDetails object. When a transfer is initiated, it comes with a status NEW this means the transfer has been queued for processing.
A sample bulk call is:
Returns
This call returns a dictionary. A sample response is:InitiateTransferError if there was a problem processing your transaction. The InitiateTransferError contains some information about your transaction. You can handle this as such:
.fetch(reference=None)
This allows you retrieve a single transfer. You may or may not pass in a reference. If you do not pass in a reference, all transfers that have been processed will be returned.
A sample fetch call is:
Returns
This call returns a dictionary. A sample response is:TransferFetchError if there was a problem processing your transaction. The TransferFetchError contains some information about your transaction. You can handle this as such:
.all()
This allows you retrieve all transfers.
A sample all Transfers call is:
Returns
This call returns a dictionary. A sample response is:TransferFetchError if there was a problem processing your transaction. The TransferFetchError contains some information about your transaction. You can handle this as such:
.getFee(currency)
This allows you get transfer rates for all Rave supported currencies. You may or may not pass in a currency. If you do not pass in a currency, all Rave supported currencies transfer rates will be returned.
A sample getFee call is:
Returns
This call returns a dictionary. A sample response is:.getBalance(currency)
This allows you get your balance in a specified. You may or may not pass in a currency. If you do not pass in a currency, your balance will be returned in the currency specified in your rave account
A sample fetch call is:
Returns
This call returns a dictionary. A sample response is:.retryTransfer(transfer_id)
This allows you to retry a previously failed transfer attempt. You are expected to pass the id for the failed transfer into this call (ids can be gotten in data object from the initial transfer response)
A sample fetch call is:
Returns
This call returns a dictionary. A sample response is:.fetchRetries(transfer_id)
This allows you to get all retry attempts for all previously failed transfer attempts.
A sample fetch call is:
Returns
This call returns a dictionary. A sample response is:Complete transfer flow
rave.Subscriptions
This is used to initiate and manage Subscriptions
Functions included:
-
.all -
.fetch -
.cancel -
.activate
.all()
This allows you retrieve all subscriptions
A sample all subscriptions call is:
Returns
This call returns a dictionary. A sample response is:PlanStatusError if there was a problem processing your transaction. The PlanStatusError contains some information about your transaction. You can handle this as such:
.fetch(subscription_id, subscription_email)
This allows you fetch a subscription. You may or may not pass in a subscription_id or subscription_email. If you do not pass in a subscription_id or subscription_email all subscriptions will be returned.
subscription_id: This is the subscription ID.
subscription_email: This is the subscription email.A sample fetch subscription call is:
Returns
This call returns a dictionary. A sample response is:PlanStatusError if there was a problem processing your transaction. The PlanStatusError contains some information about your transaction. You can handle this as such:
.cancelSubscription(subscription_id)
This allows you cancel a subscription.
subscription_id: This is the subscription ID. It can be gotten from the Rave DashboardA sample cancel subscription call is:
PlanStatusError if there was a problem processing your transaction. The PlanStatusError contains some information about your transaction. You can handle this as such:
.activate(subscription_id)
This allows you activate a subscription.
subscription_id: This is the subscription ID. It can be gotten from the Rave DashboardA sample activate subscription call is:
PlanStatusError if there was a problem processing your transaction. The PlanStatusError contains some information about your transaction. You can handle this as such:
Complete Subscriptions flow
rave.PaymentPlan
This is used to initiate and manage payment plans
Functions included:
-
.create -
.all -
.fetch -
.cancelPlan -
.edit
.create(planDetails)
This allows a customer to create a payment plan. It requires a dict planDetails containing amount, name, interval, duration.
amount: this is the amount for the plan
name: This is what would appear on the subscription reminder email
interval: This are the charge intervals possible values are:
duration: This is the frequency, it is numeric, e.g. if set to 5 and intervals is set to monthly you would be charged 5 months, and then the subscription stops.More information can be found here If duration is not passed, any subscribed customer will be charged indefinitely A sample create call is:
Returns
This call returns a dictionary. A sample response is:IncompletePaymentDetailsError if there was a problem processing your transaction. The IncompletePaymentDetailsError contains some information about your transaction. You can handle this as such:
.all()
This allows you retrieve all payment plans.
A sample all plans call is:
Returns
This call returns a dictionary. A sample response is:PlanStatusError if there was a problem processing your transaction. The PlanStatusError contains some information about your transaction. You can handle this as such:
.fetch(plan_id, plan_name)
This allows you fetch a payment plan. You may or may not pass in a plan_id or plan_name. If you do not pass in a plan_id or plan_name, all payment plans will be returned.
plan_id: This is the payment plan ID. It can be gotten from the response returned from creating a plan or from the Rave Dashboard
plan_name: This is the payment plan name. It can be gotten from the response returned from creating a plan or from the Rave DashboardA sample fetch plan call is:
Returns
This call returns a dictionary. A sample response is:PlanStatusError if there was a problem processing your transaction. The PlanStatusError contains some information about your transaction. You can handle this as such:
.cancelPlan(plan_id)
This allows you cancel a payment plan. It requires that you pass in an plan_id.
plan_id: This is the payment plan ID. It can be gotten from the response returned from creating a plan or from the Rave DashboardA sample cancelPlan call is:
Returns
This call returns a dictionary. A sample response is:PlanStatusError if there was a problem processing your transaction. The PlanStatusError contains some information about your transaction. You can handle this as such:
.edit(plan_id, newData={})
This allows you edit a payment plan. It requires that you pass in an plan_id. If you do not pass in the newData dict containing the change you want to make to your plan, the plan stays the same.
plan_id: This is the payment plan ID. It can be gotten from the response returned from creating a plan or from the Rave Dashboard
newData: AA sample cancel plan call is:dictthat must contain one or both of:name,statusas properties.namespecifies the new name for your payment plan.status: possible values areactiveandcancelled
Returns
This call returns a dictionary. A sample response is:PlanStatusError if there was a problem processing your transaction. The PlanStatusError contains some information about your transaction. You can handle this as such:
Complete PaymentPlan flow
rave.Ussd
NOTE: This payment option is still in beta mode.
rave.VirtualAccount
This is used to create virtual account for transfers.
Functions included:
.create
.create(accountDetails)
This allows a customer to create a virtual account. It requires a dict vaccountDetails containing email, seckey, is_permanant, frequency, bvn, duration and narration.
Here is an example call:
Returns
This call returns a dictionary. A sample response is:IncompleteAccountDetailsError if there was a problem creating your virtual account. The IncompleteCardDetailsError contains some information about your virtual account. You can handle this as such:
rave.VirtualCard
This is used to create virtual cards and carry out other virtual card operations.
Functions included:
-
.create -
.all -
.get -
.cancel -
.freeze -
.unfreeze -
.fund -
.withdraw
.create(vcardDetails)
This allows a customer to create a virtual card. It requires a dict vcardDetails containing currency, amount, billing name, billing address, billing city, billing state, billing postal code, billing country
A sample Create call is:
Returns
This call returns a dictionary. A sample response is:IncompleteCardDetailsError if there was a problem creating your card. The IncompleteCardDetailsError contains some information about the error encountered in creating your card. You can handle this as such:
.all()
This allows a the user to query all cards
A sample Create call is:
Returns
This call returns a dictionary. A sample response is:.get()
This allows a the user to query the details of a card with a given id.
A sample Create call is:
Returns
This call returns a dictionary. A sample response is:.cancel()
This allows a the user to terminate the use of a card with a given id permanently. This cancellation results in the permanent deletion of the card.
A sample Create call is:
Returns
This call returns a dictionary. A sample response is:.freeze()
This allows a the user to terminate the use of a card with a given id temporarily. This cancellation results in the temporary suspension of the card
A sample Create call is:
Returns
This call returns a dictionary. A sample response is:.unfreeze()
This allows a the user to resume the use of a temporarily suspended or frozen card with a given id.
A sample Create call is:
Returns
This call returns a dictionary. A sample response is:.fund()
This allows a the user to add funds to a card with a given id. the card_id, currency and amount are passed into the .fundCard() method.
A sample Create call is:
Returns
This call returns a dictionary. A sample response is:.withdraw()
This allows a the user to withdraw funds from a card with a given id. the card id and amount are passed into the .Withdraw() method.
A sample Create call is:
Returns
This call returns a dictionary. A sample response is:Testing
All of the SDK’s tests are written with Python’sunittest module. The tests currently test:
rave.Account
rave.Card
rave.Transfer
rave.Preauth
rave.Subaccount
rave.Subscriptions
rave.Paymentplan
They can be run like so:
NOTE: If the test fails for creating a subaccount, just change theaccount_numberaccount_bankandbusinesss_emailto something different
NOTE: The test may fail for account validation - Pending OTP validation depending on whether the service is down or not
Debugging Errors
We understand that you may run into some errors while integrating our library. You can read more about our error messages here. Forauthorization and validation error responses, double-check your API keys and request. If you get a server error, kindly engage the team for support.