Package: ravepaypysdk
The RavePay Python SDK provides APIs to create, process and manage
payments on the RavePay platform. The SDK fully supports the APIInstallationpip install ravepaypysdkConfiguring RavePay SDKimport ravepaypysdk

my_api = ravepaypysdk.Api(
          secret_key='ravepay_secret_key'
          public_key='ravepay_public_key'
          production=False # sandbox # or True # Live
        )UsageTo start using the SDK ensure you have your public key and secret key
instantiated with theApiobjectPayments (RavePay Direct Charge)Import the RavePay Payment modulefrom ravepaypysdk import PaymentThere are 5 different ways to utilize RavePay’s direct charge for
payment:Card direct chargeUsagepayload = {
   “cardno”: “5438898014560229”,
   “cvv”: “789”,
   “expirymonth”: “07”,
   “expiryyear”: “18”,
   “currency”: “NGN”,
   “pin”:“7552”,
   “country”: “GH”,
   “amount”: “10”,
   “email”: “user@example.com”,
   “phonenumber”: “1234555”,
   “suggested_auth”: “PIN”,
   “firstname”:“user1”,
   “lastname”: “user2”, “IP”: “355426087298442”, “txRef”:
   “MC-7663-YU”, “device_fingerprint”:
   “69e6b7f0b72037aa8428b70fbe03986c”
 }
card_payment = Payment.card(payload, api=my_api)

if card_payment:
   return card_paymentBank account paymentUsagepayload = {
  "accountnumber": "0690000004",
  "accountbank": "044",
  "currency": "NGN",
  "country": "NG",
  "amount": "10",
  "email": "user@example.com",
  "phonenumber": "1234555",
  "firstname": "first name",
  "lastname": "last name",
  "IP": "355426087298442",
  "txRef": "",
  "device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"
}
bank_payment = Payment.bank_account(payload, api=my_api)

if bank_payment:
   return bank_paymentTokenize CardUsagepayload = {
  "token":{
      “chargeToken”:{
           “user_token”:“f0209”,
           “embed_token”:“flw-t0-9f3aa69a806f6440fbb78cc9e8b2f135-k3n”
       }
  },
  "currency": "NGN",
  "country": "NG",
  "amount": "10",
  "email": "user@example.com",
  "phonenumber": "1234555",
  "firstname": "user1",
  "lastname": "user2",
  "IP": "355426087298442",
  "txRef": "MC-7663-YU",
  "narration":"tokenize my card"
  "meta": [{"metaname": "flightId"}, {"metavalue": "1002"}]
  "device_fingerprint": "69e6b7f0b72037aa8428b70fbe03986c"
}

tokenize_card = Payment.tokenize_card(payload, api=my_api)USSD PaymentUsageussd_payment = Payment.ussd(payload, api=my_api)MPESA PaymentUsagempesa_payment = Payment.mpesa(payload, api=my_api)Ghana Mobile MoneyUsagegh_mobile_payment = Payment.ghana_mobile(payload, api=my_api)The same payload format goes for theUSSD,MPESAandGhana
Mobile Money. Kindly review theAPI
documentationto get the required field for each transactionTransactionThis module retrieves all transactions and verifies transactions.UsageImport the transaction modulefrom ravepaypysdk import TransactionVerify your transactionUsagepayload = {
  “flw_ref”:“FLW-MOCK-6f52518a2ecca2b6b090f9593eb390ce”, # unique reference
  “tx_ref”:“dummy”, # merchants unique reference number
  “normalize”: “1”
}
verify_transaction = Transaction.verify(payload, api=my_api)verify transaction with xqueryUsagepayload = {
   “flwref”: “FLW-MOCK-6f52518a2ecca2b6b090f9593eb390ce”, # unique reference
   “txref”:“dummy”, # merchants unique reference number
   “last_attempt”:“1”, # retrieves the last transaction
   “only_successful”: “1” # retrieves only successful transaction
 }
xquery_verify = Transaction.verify_query(payload, api=my_api)List all recurring transactionsUsagelist_transactions  = Transaction.list_all_recurring(api=my_api)List single recurring transactionsUsagepayload = {
    "txId":"dummy" #add the required value for txId
}
list_single_transaction = Transaction.list_single_recurring(payload, api=my_api)PreAuthorizationThis module performs preauthorization transactions on the RavePay
platformUsageImport the PreAuthorization modulefrom ravepaypysdk import PreAuthorization-Preauthorization Capture*Usage*
::
  payload = {
      "flwRef":"39448fhdhhfdhshshf" # add the required value
  }
  preauthorize_capture = PreAuthorization.capture(payload, api=my_api)Preauthorize Card transactionUsagePayload is the same as direct charge card payment payload

preauthorize_card = PreAuthorization.card(payload, api=my_api)Preauthorize void or refund transactionsUsagepayload = {
    "flwRef":"dummy" # add the value from the capture response
    "action": "refund or void" # select what action i.e refund or void
}
preauth_void_refund = PreAuthorization.void_or_refund(payload, api=my_api)Validate Ravepay chargesThis module validates RavePay payment
transactions.UsageImport the ValidateCharge modulefrom ravepaypysdk import ValidateCharge
payload = {
     "transaction_reference": "222334304",
     "otp": "12345"
 }Validate card transactionsUsagevalidate_card_transac = ValidateCharge.card(payload, api=my_api)Validate bank account transactionUsagevalidate_bank_account_transac = ValidateCharge.account(payload, api=my_api)SubscriptionsThis module retrieves, cancels and activates subscriptions on the
RavePay PlatformUsageImport the subscriptions modulefrom ravepaypysdk import SubscriptionsActivate SubscriptionUsage#sub_id is the subscription id
activate_subscription = Subscriptions.activate(sub_id=50, api=my_api)Cancel SubscriptionUsage#sub_id is the subscription id
cancel_subscription = Subscriptions.cancel(sub_id=50, api=my_api)Fetch Single SubscriptionUsage#params is the subscription id
single_subscription = Subscriptions.fetch_single(params=70, api=my_api)Fetch All SubscriptionsUsageall_subscriptions = Subscriptions.fetch_all(api=my_api)Payment PlanThis module creates, retrieves, edit and cancel payment plans on the
platformUsageImport the Payment plan modulefrom ravepaypysdk import PaymentPlan

#plan_id is the payment plan identifierCreate Payment PlanUsagepayload = {
  "amount": 3000,
  "name": 'New User',
  "intervals": "daily",
  "duration": 0
}
create_plan = PaymentPlan.create(payload, api=my_api)Edit Payment PlanUsagepayload = {
  "amount": 1000,
  "name": 'New User',
  "intervals": "monthly",
  "duration": 0
}

edit_plan = PaymentPlan.edit_plan(payload, plan_id=60, api=my_api)Cancel PaymentUsagecancel_plan = PaymentPlan.cancel_plan(plan_id=60, api=my_api)Fetch Single Payment PlanUsagefetch_single_plan = PaymentPlan.fetch_single_plan(params=40, api=my_api)Fetch All Payment PlansUsagefetch_all_plans = PaymentPlan.fetch_all_plan(api=my_api)MiscellanousThis module gets the bank list and current forex ratesUsageImport the bank modulefrom ravepaypysdk import BankGet List of BanksUsageget_banks = Bank.list_all(api=my_api)Get Forex RatesUsagepayload = {
 'origin_currency': 'USD',
 'destination_currency': 'NGN',
 'amount': '200'
 }
get_forex = Bank.get_forex(payload, api=my_api)DocumentationAPI documentation for RavePay can be foundhereContributingContributions are always welcomed to the project. Use Github Issue for
requests.Fork the project to your repository then clone it to your local
machine.Create a new branch and make the necessary enhancement to the
features.If the you wish to update an existing enhancement submit a pull
request.If you are unsure about certain areas in the project feel to ask for
assistance.