{"id":19658423,"url":"https://github.com/iphytech/flutterwave-ruby-sdk","last_synced_at":"2025-06-30T01:32:36.492Z","repository":{"id":102247845,"uuid":"270002370","full_name":"Iphytech/Flutterwave-Ruby-SDK","owner":"Iphytech","description":"V3 - Rave payment library for Ruby","archived":false,"fork":false,"pushed_at":"2020-07-07T08:49:12.000Z","size":68,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-27T02:34:50.451Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Iphytech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-06T14:15:51.000Z","updated_at":"2020-10-09T07:38:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"2310dbe7-184b-4032-87b8-568658d64922","html_url":"https://github.com/Iphytech/Flutterwave-Ruby-SDK","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Iphytech/Flutterwave-Ruby-SDK","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iphytech%2FFlutterwave-Ruby-SDK","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iphytech%2FFlutterwave-Ruby-SDK/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iphytech%2FFlutterwave-Ruby-SDK/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iphytech%2FFlutterwave-Ruby-SDK/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Iphytech","download_url":"https://codeload.github.com/Iphytech/Flutterwave-Ruby-SDK/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Iphytech%2FFlutterwave-Ruby-SDK/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262693278,"owners_count":23349708,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T15:37:34.078Z","updated_at":"2025-06-30T01:32:36.471Z","avatar_url":"https://github.com/Iphytech.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flutterwave V3 SDK\n\nThis is a Ruby gem for easy integration of Flutterwave V3 API for various applications written in Ruby language from [Flutterwave](https://rave.flutterwave.com/)\n\n# V3 Documentation\n\nSee [Here](https://developer.flutterwave.com/reference) for Flutterwave V3 API Docs.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'flutterwave_sdk'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install flutterwave_sdk\n\n## Usage\n\n## Instantiate Flutterwave Object\nTo use [Flutterwave Ruby SDK](https://ravesandbox.flutterwave.com), you need to instantiate the RaveRuby class with your [API](https://dashboard.flutterwave.com/dashboard/settings/apis) keys which are your public, secret and encryption keys. We recommend that you store your API keys in your environment variable named `FLUTTERWAVE_PUBLIC_KEY`, `FLUTTERWAVE_SECRET_KEY` and `FLUTTERWAVE_ENCRYPTION_KEY`. Instantiating your flutterwave object after adding your API keys in your environment is as illustrated below:\n\n```ruby\npayment = Flutterwave.new\n```\nThis throws a `FLUTTERWAVEBadKeyError` if no key is found in the environment variable or invalid public or secret key is found.\n\n#### Instantiate FLutterwave object in sandbox without environment variable:\n\nYou can instantiate your Flutterwave object by setting your public, secret and encryption keys by passing them as an argument of the `Flutterwave` class just as displayed below: \n\n```ruby\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxxxx-X\", \"FLWSECK-xxxxxxxxx-X\", \"xxxxxxxxxxx\")\n```\n\n#### `NOTE:` It is best practice to always set your API keys to your environment variable for security purpose. Please be warned not use this package without setting your API keys in your environment variables in production.\n\n#### To instantiate Flutterwave object in production with environment variable:\n\nSimply use it as displayed below:\n\n```ruby\nPayment = Flutterwave.new(\"YOUR_FLUTTERWAVE_LIVE_PUBLIC_KEY\", \"YOUR_FLUTTERWAVE_LIVE_SECRET_KEY\", \"YOUR_ENCRYPTION_KEY\", true)\n```\n\n### Flutterwave Objects\n- [Card.new(payment)](#cardnewpayment)\n- [AccountPayment.new(payment)](#accountpaymentnewpayment)\n- [Bank.new(payment)](#banknewpayment)\n- [Bills.new(payment)](#billsnewpayment)\n- [BankTransfer.new(payment)](banktransfernewpayment)\n- [Beneficiaries.new(payment)](#beneficiariesnewpayment)\n- [USSD.new(payment)](#ussdnewpayment)\n- [Transfer.new(payment)](#transfernewpayment)\n- [VirtualCard.new(payment)](#virtualcardnewpayment)\n- [TokenizedCharge.new(payment)](#tokenizedchargenewpayment)\n- [Settlements.new(payment)](#settlementsnewpayment)\n- [QR.new(payment)](#qrnewpayment)\n- [Transactions.new(payment)](#transactionsnewpayment)\n- [VirtualAccountNumber.new(payment)](#virtualaccountnumbernewpayment)\n- [Subscriptions.new(payment)](#subscriptionsnewpayment)\n- [OTP.new(payment)](#otpnewpayment)\n- [Subaccount.new(payment)](#subaccountnewpayment)\n- [PaymentPlan.new(payment)](#paymentplannewpayment)\n- [MobileMoney.new(payment)](#mobilemoneynewpayment)\n- [Misc.new(payment)](#miscnewpayment)\n- [Preauth.new(payment)](preauthnewpayment)\n\n## Card.new(payment)\n\n\u003e  \u003cmark\u003eNB - Flutterwave's direct card charge endpoint requires PCI-DSS compliance \u003c/mark\u003e\n\n\u003e To charge cards, you will need to be PCI DSS compliant. If you are, you can proceed to charge cards.\nAlternatively, you can use any of our other payment methods such as Standard, Inline or SDKs which do not require processing card details directly and do not also require payload encryption.\n\n\nTo perform account transactions, instantiate the card object and pass Flutterwave object as its argument.\n#### Its functions includes:\n\n- .initiate_charge\n- .validate_charge\n- .verify_charge\n\n\n## Full Account Transaction Flow\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxx-X\", \"FLWSECK-xxxxxxxxx-X\", \"xxxxxxxxxxxxxxxxxxxxxxx\")\n\n# This is used to perform card charge\n\npayload = {\n\n    \"card_number\" =\u003e \"5531886652142950\",\n    \"cvv\" =\u003e \"564\",\n    \"expiry_month\" =\u003e \"09\",\n    \"expiry_year\" =\u003e \"22\",\n    \"currency\" =\u003e \"NGN\",\n    \"amount\" =\u003e \"10\",\n    \"email\" =\u003e \"xxxxxxxxxx@gmail.com\",\n    \"fullname\" =\u003e \"Test Name\",\n    \"tx_ref\" =\u003e \"MC-3243e-if-12\",\n    \"redirect_url\" =\u003e \"https://webhook.site/399\"\n    \n}\ncharge_card = Card.new(payment)\n\nresponse = charge_card.initiate_charge(payload)\nputs response\n\n# update payload with suggested auth\nif response[\"meta\"][\"authorization\"][\"mode\"]\n    suggested_auth = response[\"meta\"][\"authorization\"][\"mode\"]\n    auth_arg = charge_card.get_auth_type(suggested_auth)\n    if auth_arg == :pin\n        updated_payload = charge_card.update_payload(suggested_auth, payload, pin: { \"pin\" =\u003e \"3310\"} )\n    elsif auth_arg == :address\n        updated_payload = charge_card.update_payload(suggested_auth, payload, address:{ \"zipcode\"=\u003e \"07205\", \"city\"=\u003e \"Hillside\", \"address\"=\u003e \"470 Mundet PI\", \"state\"=\u003e \"NJ\", \"country\"=\u003e \"US\"})\n    end\n\n    #  perform the second charge after payload is updated with suggested auth\n    response = charge_card.initiate_charge(updated_payload)\n    print response\n    \n   # perform validation if it is required\n    if response[\"data\"][\"status\"] == \"pending\" || \"success-pending-validation\"\n        response = charge_card.validate_charge(response[\"data\"][\"flw_ref\"], \"12345\")\n        print response\n    end\nelse\n    # You can handle the get the auth url from this response and load it for the customer to complete the transaction if an auth url is returned in the response.\n    print response\nend\n\n# verify charge\nresponse = charge_card.verify_charge(response[\"data\"][\"id\"])\nprint response\n\n```\n\n## AccountPayment.new(payment)\n#### Its functions includes:\n\n- .initiate_charge\n- .validate_charge\n- .verify_charge\n\n## Full Account Transaction Flow\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxx-X\", \"FLWSECK-xxxxxxx-X\", \"xxxxxxx\")\n\npayload = {\n    \"tx_ref\" =\u003e \"MC-1585230ew9v505010\",\n    \"amount\" =\u003e \"100\",\n    \"account_bank\" =\u003e \"044\",\n    \"account_number\" =\u003e \"0690000037\",\n    \"currency\" =\u003e \"NGN\",\n    \"email\" =\u003e \"xxxxxxx@gmail.com\",\n    \"phone_number\" =\u003e \"09000000000\",\n    \"fullname\" =\u003e \"Test Name\"\n}\n\naccount_payment_ng = AccountPayment.new(payment)\n\nresponse = account_payment_ng.initiate_charge(payload)\nprint response\n\n#validate payment with OTP\nif response[\"data\"][\"meta\"][\"authorization\"][\"mode\"] == \"otp\"\n    response = account_payment_ng.validate_charge(response[\"data\"][\"flw_ref\"], \"12345\")\n    print response\nelse\n    print response\n\nend\n\n#verify transaction\nresponse = account_payment_ng.verify_charge(response[\"data\"][\"tx_ref\"])\n\nprint response\n\n```\n\n\n## Bank.new(payment)\n#### Its functions includes:\n\n- .get_all_banks\n- .get_bank_branch\n\n## See the full flow below\n\n```ruby\n\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxx-X\", \"FLWSECK-xxxxxxxxxx-X\", \"xxxxxxxxx\")\nbank = Bank.new(payment)\n\n#get all banks\nresponse = bank.get_all_banks(\"NG\")\n print response\n\n# get bank branches\nresponse = bank.get_bank_branch(280)\n print response\n\n```\n\n## Bills.new(payment)\n#### Its functions includes:\n\n- .create_bill_payment\n- .create_bulk_bill_payments\n- .get_status_of_a_bill_payment\n- .update_bills_order\n- .validate_bill_service\n- .get_bill_categories\n- .get_bill_payment_agencies\n- .get_amount_for_a_product\n- .get_bill_payments\n- .get_products_under_an_agency\n- .create_order_using_billing_code_and_productid\n\n## See full flow below\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK_TEST-3xxxxxxxxxx-X\", \"FLWSECK_TEST-xxxxxxxxx-X\", \"xxxxxxxxxxxxx\")\nbill = Bills.new(payment)\n\n\n# Create a bill payment \npayload = {\n\t\"country\" =\u003e \"NG\",\n\t\"customer\" =\u003e \"+23490803840303\",\n\t\"amount\" =\u003e 500,\n\t\"recurrence\" =\u003e \"ONCE\",\n\t\"type\" =\u003e \"AIRTIME\",\n\t\"reference\" =\u003e \"ifunaya-0987654\"\n }\n\n response = bill.create_bill_payment(payload)\n print response\n\n#bulk bill payments\npayload = {\n    \"bulk_reference\" =\u003e \"edf-12de5223d2f32\",\n    \"callback_url\" =\u003e \"https://webhook.site/5f9a659a-11a2-4925-89cf-8a59ea6a019a\",\n    \"bulk_data\" =\u003e [\n       {\n          \"country\" =\u003e \"NG\",\n          \"customer\" =\u003e \"+23490803840303\",\n          \"amount\" =\u003e 500,\n          \"recurrence\" =\u003e \"WEEKLY\",\n          \"type\" =\u003e \"AIRTIME\",\n          \"reference\" =\u003e \"930049200929\"\n        },\n        {\n          \"country\" =\u003e \"NG\",\n          \"customer\" =\u003e \"+23490803840304\",\n          \"amount\" =\u003e500,\n          \"recurrence\" =\u003e \"ONCE\",\n          \"type\": \"AIRTIME\",\n          \"reference\" =\u003e \"930004912332\"\n        }\n    ]\n}\n\nresponse = bill.create_bulk_bill_payments(payload)\nprint response\n\n\n#get the status of a bill payment\nresponse = bill.get_status_of_a_bill_payment(\"BPUSSD1591303717500102\")\nprint response\n\n#get billers categories\nresponse = bill.get_bill_categories\nprint response\n```\n\n## BankTransfer.new(payment)\n#### Its functions includes:\n\n- .initiate_charge\n- .verify_charge\n\n## See full flow below\n\n```ruby\n\nrequire 'flutterwave_sdk'\n\n# This is a FLutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxxxx-X\", \"FLWSECK-xxxxxxxxx-X\", \"xxxxxxxxxxx\")\n\npayload = {\n    \"tx_ref\" =\u003e \"MC-158523095056793\",\n    \"amount\" =\u003e \"1500\",\n    \"email\" =\u003e \"xxxxxxxxx@gmail.com\",\n    \"phone_number\" =\u003e \"054709929220\",\n    \"currency\" =\u003e \"NGN\",\n    \"duration\" =\u003e 2,\n    \"frequency\" =\u003e 5,\n    \"narration\" =\u003e \"All star college salary for May\",\n    \"is_permanent\" =\u003e 1\n}\n\nbank_transfer = BankTransfer.new(payment)\n\nresponse = bank_transfer.initiate_charge(payload)\n\nprint response\n\n# verify transaction\nresponse = bank_transfer.verify_charge(response[\"data\"][\"tx_ref\"])\n\nprint response\n```\n\n## Beneficiaries.new(payment)\n#### Its functions includes:\n\n- .create_beneficiary\n- .list_beneficiaries\n- .fetch_beneficiary\n- .delete_beneficiary\n\n## See full flow below\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxxxx-X\", \"FLWSECK-xxxxxxxx-X\", \"xxxxxxxxxx\")\nBeneficiary = Beneficiaries.new(payment)\n\n#create a beneficiary\npayload = {\n        \"account_number\" =\u003e \"0690000032\",\n        \"account_bank\" =\u003e \"044\"\n    }\n\nresponse = Beneficiary.create_beneficiary(payload)\nprint response\n\n#list beneficiaries\n\nresponse = Beneficiary.list_beneficiaries\n\nprint response\n\n\n#fetch beneficiary\nresponse = Beneficiary.fetch_beneficiary(7369)\nprint response\n\n\n#delete beneficiary\nresponse = Beneficiary.delete_beneficiary(7369)\nprint response\n\n```\n\n## USSD.new(payment)\n#### Its functions includes:\n\n- .initiate_charge\n- .verify_charge\n\n## See full flow below\n\n```ruby\n\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxx-X\", \"FLWSECK-xxxxxxx-X\", \"xxxxxx\")\n\npayload = {\n    \"tx_ref\" =\u003e \"MC-15852309v5050w34\",\n    \"account_bank\" =\u003e \"044\",\n    \"amount\" =\u003e \"1500\",\n    \"currency\" =\u003e \"NGN\",\n    \"email\" =\u003e \"xxxxxxxxxxxxx@gmail.com\",\n    \"phone_number\" =\u003e \"054709929220\",\n    \"fullname\" =\u003e \"Test Name\"\n\n}\n\nussd = USSD.new(payment)\n\nresponse = ussd.initiate_charge(payload)\nprint response\n\n\n# verify transactioin with the id\nresponse = ussd.verify_charge(283516336)\nprint response\n\n```\n\n## Transfer.new(payment)\n#### Its functions includes:\n\n- .transfer_fee\n- .initiate_transfer\n- .initiate_bulk_transfer\n- .get_all_transfers\n- .get_a_transfer\n\n## See full flow below\n\n```ruby\n\n\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxx-X\", \"FLWSECK-xxxxxxx-X\", \"xxxxxxxxx\")\n\ntransfer = Transfer.new(payment)\npayload = {\n    \"account_bank\" =\u003e \"044\",\n    \"account_number\" =\u003e \"0690000040\",\n    \"amount\" =\u003e 5000,\n    \"narration\" =\u003e \"Akhlm Pstmn Trnsfr xx007\",\n    \"currency\" =\u003e \"NGN\",\n    \"reference\" =\u003e \"eightm-pstmnpyt-rfxx007_P0MCKDU_1\",\n    \"callback_url\" =\u003e \"https://webhook.site/b3e505b0-fe02-430e-a538-22bbbce8ce0d\",\n    \"debit_currency\" =\u003e \"NGN\"\n}\n\nresponse = transfer.initiate_transfer(payload)\nprint response\n\n\n# get transfer fee\ncurrency = \"NGN\"\namount = \"5000\"\nresponse = transfer.transfer_fee(currency, amount)\nprint response\n\n#get all transfers\nresponse = transfer.get_all_transfers\nprint response\n\n#get a transfer\nresponse = transfer.get_a_transfer(125445)\nprint response\n\n```\n\n## VirtualCard.new(payment)\n#### Its functions includes:\n\n- .create_virtual_card\n- .get_all_virtual_cards\n- .get_virtual_card\n- .fund_virtual_card\n- .terminate_virtual_card\n- .get_virtual_card_transactions\n- .withdraw_from_virtual_card\n- .block_unblock_virtual_card\n\n\n## See full flow below\n\n```ruby\n\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK_TEST-xxxxxxxx-X\", \"FLWSECK_TEST-xxxxxx-X\", \"xxxxxxxxx\")\nvirtual_card = VirtualCard.new(payment)\n\n\ncreate virtual card\n    payload = {\"currency\" =\u003e \"NGN\",\n    \"amount\" =\u003e 20000,\n    \"billing_name\" =\u003e \"Test Name\",\n    \"billing_address\" =\u003e \"2014 Forest Hills Drive\",\n    \"billing_city\" =\u003e \"Node\",\n    \"billing_state\" =\u003e \"Javascript\",\n    \"billing_postal_code\" =\u003e \"000009\",\n    \"billing_country\" =\u003e \"NG\",\n    \"callback_url\" =\u003e \"https://your-callback-url.com/\"\n}\n\nresponse = virtual_card.create_virtual_card(payload)\n\nprint response\n\n\n#get all virtual cards\nresponse = virtual_card.get_all_virtual_cards\nprint response\n\n\n#get a virtual card\nresponse = virtual_card.get_virtual_card(\"594715a6-ae77-483c-811e-19057aedacff\")\nprint response\n\n\n#fund a virtual card\npayload = {\n    \"debit_currency\" =\u003e \"NGN\",\n    \"amount\" =\u003e 4000\n}\n\nid = \"594715a6-ae77-483c-811e-19057aedacff\"\nresponse = virtual_card.fund_virtual_card(id, payload)\nprint response\n\n#get virtual card transactions\nfrom = \"2019-01-01\"\nto = \"2020-01-13\"\nindex = 0\nsize = 1\n\nresponse = virtual_card.get_virtual_card_transactions(\"594715a6-ae77-483c-811e-19057aedacff\", from, to, index, size)\n\n\n#withdraw from a virtual card\npayload = {\n    \"amount\" =\u003e \"1000\"\n}\n\nid = \"594715a6-ae77-483c-811e-19057aedacff\"\n\nresponse = virtual_card.withdraw_from_virtual_card(id,payload)\nprint response\n\n#block/unblock virtualcard\nid = \"594715a6-ae77-483c-811e-19057aedacff\"\nstatus_action = \"unblock\"\nresponse = virtual_card.block_unblock_virtual_card(id,status_action)\nprint response\n\n```\n\n## TokenizedCharge.new(payment)\n#### Its functions includes:\n\n- .tokenized_charge\n- .verify_tokenized_charge\n- .update_token\n- .bulk_tokenized_charge\n- .bulk_tokenized_charge_status\n- .bulk_tokenized_charge_transactions\n\n## See full flow below\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxxxxx-X\", \"FLWSECK-xxxxxxxxxx-X\", \"xxxxxxxxxxxxx\")\n\n# This is used to perform card charge\npayload = {\n    \"token\" =\u003e \"flw-t1nf-264db944ee46d0a2627573a496f5432c-m03k\",\n    \"currency\" =\u003e \"NGN\",\n    \"country\" =\u003e \"NG\",\n    \"amount\" =\u003e \"10\",\n    \"email\" =\u003e \"user@example.com\",\n    \"first_name\" =\u003e \"Test\",\n    \"last_name\" =\u003e \"Name\",\n    \"ip\" =\u003e \"pstmn\",\n    \"narration\" =\u003e \"testing charge with token\"\n}\n\ncharge_with_token = TokenizedCharge.new(payment)\nresponse = charge_with_token.tokenized_charge(payload)\nprint response\n\n# Verify tokenized transaction\nresponse = charge_with_token.verify_tokenized_charge(response[\"data\"][\"tx_ref\"])\nprint response\n\n\n#update token\npayload = {\n    \"email\" =\u003e \"user@example.com\",\n    \"first_name\" =\u003e \"Test\",\n    \"last_name\" =\u003e \"Name\", \n    \"phone_number\" =\u003e \"09000000000000\"\n}\ncharge_with_token = TokenizedCharge.new(payment)\n\ntoken = \"flw-t1nf-264db944ee46d0a2627573a496f5432c-m03k\"\n\nresponse = charge_with_token.update_token(payload, token)\nprint response\n\n\n#bulk tokenized charge\n\npayload = {\n        \"title\" =\u003e \"test\",\n        \"retry_strategy\" =\u003e {\n            \"retry_interval\" =\u003e 120,\n            \"retry_amount_variable\" =\u003e 60,\n            \"retry_attempt_variable\" =\u003e 2,\n        },\n        \"bulk_data\" =\u003e [\n            {\n                    \"token\" =\u003e \"flw-t1nf-264db944ee46d0a2627573a496f5432c-m03k\",\n                    \"currency\" =\u003e \"NGN\",\n                    \"country\" =\u003e \"NG\",\n                    \"amount\" =\u003e \"10\",\n                    \"email\" =\u003e \"user@example.com\",\n                    \"first_name\" =\u003e \"Test\",\n                    \"last_name\" =\u003e \"Name\",\n                    \"ip\" =\u003e \"pstmn\",\n                    \"narration\" =\u003e \"testing charge with token\",\n            },\n            {\n                \"token\" =\u003e \"flw-t1nf-264db944ee46d0a2627573a496f5432c-m03k\",\n                \"currency\" =\u003e \"NGN\",\n                \"country\" =\u003e \"NG\",\n                \"amount\" =\u003e \"10\",\n                \"email\" =\u003e \"user@example.com\",\n                \"first_name\" =\u003e \"Test\",\n                \"last_name\" =\u003e \"Name\",\n                \"ip\" =\u003e \"pstmn\",\n                \"narration\" =\u003e \"testing charge with token\"\n            }\n        ]\n    }\n\n    charge_with_token = TokenizedCharge.new(payment)\n    response = charge_with_token.bulk_tokenized_charge(payload)\n\nprint response\n\n\n#get status of bulk tokenized charges\nid =  175\ncharge_with_token = TokenizedCharge.new(payment)\nresponse = charge_with_token.bulk_tokenized_charge_status(id)\nprint response\n\n\n#fetch bulk tokenized transactions\nid =  175\ncharge_with_token = TokenizedCharge.new(payment)\nresponse = charge_with_token.bulk_tokenized_charge_transactions(id)\nprint response\n\n```\n\n## Settlements.new(payment)\n#### Its functions includes:\n\n- .get_settlements\n- .get_settlement\n\n## See full flow below\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK_TEST-xxxxxxxxx-X\", \"FLWSECK_TEST-xxxxxxxxxx-X\", \"xxxxxxxxxxxxx\")\nsettlement = Settlements.new(payment)\n\n\n# get all settlements\nresponse = settlement.get_settlements\nprint response\n\n\n#get a settlment\nresponse =settlement.get_settlement(63016)\nprint response\n\n```\n\n## QR.new(payment)\n#### Its functions includes:\n\n- .initiate_charge\n- .verify_charge\n\n## See full flow below\n\n```ruby\n\nrequire 'flutterwave_sdk'\n\n# This is a FLutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxxxx-X\", \"FLWSECK-xxxxxxxxxxxxxxx-X\", \"xxxxxxxxxxxxxxxx\")\n\npayload = {\n    \"tx_ref\" =\u003e \"MC-15852309v5050w34\",\n    \"amount\" =\u003e \"1500\",\n    \"currency\" =\u003e \"NGN\",\n    \"email\" =\u003e \"xxxxxxxxxxxx@gmail.com\",\n    \"phone_number\" =\u003e \"090000000000\",\n    \"fullname\" =\u003e \"Test name\"\n\n}\n\nqr = QR.new(payment)\n\nresponse = qr.initiate_charge(payload)\nprint response\n\n# verify QR transaction\nresponse = qr.verify_charge(response[\"data\"][\"tx_ref\"])\nprint response\n\n```\n\n## Transactions.new(payment)\n#### Its functions includes:\n\n- .transaction_fee\n- .get_transactions\n- .verify_transaction\n- .transactions_events\n- .initiate_a_refund\n- .resend_transaction_webhook\n\n## see full flow below\n\n```ruby\n\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxxxx-X\", \"FLWSECK-xxxxxxxxxxxxxxxxxx-X\", \"xxxxxxxxxxxxxxx\")\n\nfee = Transactions.new(payment)\ncurrency = \"NGN\"\namount = \"1000\"\nresponse = fee.transaction_fee(currency, amount)\nprint response\n\n\n# get Transactions\nfee = Transactions.new(payment)\nresponse = fee.get_transactions\nprint response\n\n# get transaction events\nfee = Transactions.new(payment)\nresponse = fee.transactions_events(1321548)\nprint response\n\n# initiate a refund\npayload = {\n    \"amount\" =\u003e \"5\"\n}\n# id = 1321548\nfee = Transactions.new(payment)\nresponse = fee.initiate_a_refund(payload, 1321548)\nprint response\n\n#resend transaction webhook\npayload = {\n    \"id\" =\u003e 1321548\n}\nfee = Transactions.new(payment)\nresponse = fee.resend_transactions_webhook(payload)\nprint response\n\n```\n\n## VirtualAccountNumber.new(payment)\n#### Its functions includes:\n\n- .create_virtual_account_number\n- .create_bulk_virtual_account_number\n- .get_bulk_virtual_account_number\n- .get_virtual_account_number\n\n# see full flow below\n\n```ruby\n\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK_TEST-xxxxxxxx-X\", \"FLWSECK_TEST-xxxxxxxxxx-X\", \"xxxxxxxxx\")\naccount_number = VirtualAccountNumber.new(payment)\n\n\n# #create virtual account number\n payload = {\n    \"email\" =\u003e \"xxxxxxxxxx@gmail.com\",\n    \"duration\" =\u003e 5,\n    \"frequency\" =\u003e 5,\n    \"is_permanent\" =\u003e true,\n    \"tx_ref\" =\u003e \"jhn-Test-10192029920\"\n}\n\nresponse = account_number.create_virtual_account_number(payload)\nprint response\n\n#bulk account number\npayload = {\n    \"email\" =\u003e \"xxxxxxxxx@gmail.com\",\n    \"duration\" =\u003e 5,\n    \"accounts\" =\u003e 5,\n    \"is_permanent\" =\u003e true,\n    \"tx_ref\" =\u003e \"jhn-Test-10192029920\"\n}\n\nresponse = account_number.create_bulk_virtual_account_number(payload)\nprint response\n\n\n# get bulk virtual account number\nresponse = account_number.get_bulk_virtual_account_number(\"-RND_1071591303048505\")\nprint response\n\n# Get a virtual account number \nresponse = account_number.get_virtual_account_number(\"URF_1591302653177_6055335\")\nprint response\n\n```\n\n## Subscriptions.new(payment)\n#### Its functions includes:\n\n- .get_all_subscriptions\n- .cancel_subscription\n- .activate_subscription\n\n# see full flow below\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxx-X\", \"FLWSECK-xxxxxxxxxx-X\", \"xxxxxxxxxxx\")\nsubscription = Subscriptions.new(payment)\n\n#get all subscriptions\nresponse = subscription.get_all_subscriptions\nprint response\n\n#cancel subscription\nresponse = subscription.cancel_subscription(247490)\nprint response\n\n#activate subcription\nresponse = subscription.activate_subscription(247490)\nprint response\n\n```\n\n## OTP.new(payment)\n#### Its functions includes:\n\n- .create_otp\n- .validate_otp\n\n# see full flow below\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK_TEST-xxxxxxxxxxxxxx-X\", \"FLWSECK_TEST-xxxxxxxxxxxx-X\", \"xxxxxxxxx\")\notp = OTP.new(payment)\n\npayload = {\n    \"length\" =\u003e 7,\n\t\"customer\" =\u003e { \"name\" =\u003e \"Test\", \"email\" =\u003e \"xxxxxxxxxxx@gmail.com\", \"phone\" =\u003e \"2348131149273\" },\n\t\"sender\" =\u003e \"Test Name\",\n\t\"send\" =\u003e true,\n\t\"medium\" =\u003e [\"email\", \"whatsapp\"],\n\t\"expiry\" =\u003e 5\n}\n\nresponse = otp.create_otp(payload)\nprint response\n\n#validate otp\npayload = {\n    \"otp\" =\u003e 481208\n}\n\nreference = \"CF-BARTER-20190420022611377491\"\nresponse = otp.validate_otp(reference, payload)\nprint response\n\n```\n\n## Subaccount.new(payment)\n#### Its functions includes:\n\n- .create_subaccount\n- .fetch_subaccounts\n- .fetch_subaccount\n- .update_subaccount\n- .delete_subaccount\n\n## see full flow below\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK_TEST-xxxxxxxx-X\", \"FLWSECK_TEST-xxxxxxxx-X\", \"xxxxxx\")\nsubaccount = Subaccount.new(payment)\n\n#create subaccount\npayload = {\n    \"account_bank\" =\u003e \"044\",\n    \"account_number\" =\u003e \"0690000036\",\n    \"business_name\" =\u003e \"Test Name\",\n    \"business_email\" =\u003e \"xxxxxx@gmail.com\",\n    \"business_contact\" =\u003e \"Anonymous\",\n    \"business_contact_mobile\" =\u003e \"090890382\",\n    \"business_mobile\" =\u003e \"09087930450\",\n    \"country\" =\u003e \"NG\",\n    \"split_type\" =\u003e \"percentage\",\n    \"split_value\" =\u003e 0.5\n}\n\nreponse = subaccount.create_subaccount(payload)\nprint reponse\n\n#fetch all subaccounts\nreponse = subaccount.fetch_subaccounts\nprint reponse\n\n\n#fetch a sub account\nreponse = subaccount.fetch_subaccount(5740)\nprint reponse\n\n\n#update subaccount\npayload = {\n    \"business_email\" =\u003e \"xxxxx@gmail.com\"\n}\nid = 5740\nreponse = subaccount.update_subaccount(id, payload)\nprint reponse\n\n\n#delete subaccount\nreponse = subaccount.delete_subaccount(5740)\nprint reponse\n\n```\n\n## PaymentPlan.new(payment)\n#### Its functions includes:\n\n- .create_payment_plan\n- .get_payment_plans\n- .get_a_payment_plan\n- .update_payment_plan\n- .cancel_payment_plan\n\n## see full flow below\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxx-X\", \"FLWSECK-xxxxxxxxxx-X\", \"xxxxxxxxxxxxx\")\npayment_plan = PaymentPlan.new(payment)\n\n#create payment plan\n payload = {\n    \"amount\" =\u003e 5000,\n    \"name\" =\u003e  \"the akhlm postman plan 2\",\n    \"interval\" =\u003e \"monthly\",\n    \"duration\" =\u003e 48\n }\n\n response = payment_plan.create_payment_plan(payload)\n print response\n\n\n#get payment plans\nresponse = payment_plan.get_payment_plans\nprint response\n\n#get a payment plan\nresponse = payment_plan.get_a_payment_plan(5981)\nprint response\n\n#update a payment plan\npayload = {\n    \"name\" =\u003e \"Test name\",\n    \"status\" =\u003e \"active\"\n}\n\nresponse = payment_plan.update_payment_plan(5981, payload)\nprint response\n\n#cancel payment plan\nresponse = payment_plan.cancel_payment_plan(5981)\nprint response\n\n```\n\n## MobileMoney.new(payment)\n#### Its functions includes:\n\n- .initiate_charge\n- .verify_charge\n\n## see full flow below\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxxxxxxxx-X\", \"FLWSECK-xxxxxxxxxxxx-X\", \"xxxxxxxxxx\")\n\n# This is used to perform Mpesa transaction\npayload =  {\n    \"tx_ref\" =\u003e \"khlm-158943942o3\",\n    \"amount\" =\u003e \"50\",\n    \"currency\" =\u003e \"KES\",\n    \"email\" =\u003e \"johnmadakin@gmail.com\",\n    \"phone_number\" =\u003e \"054709929220\",\n    \"fullname\" =\u003e \"John Madakin\",\n    \"client_ip\" =\u003e \"154.123.220.1\",\n    \"device_fingerprint\" =\u003e \"62wd23423rq32dskd4323qew1\"\n    \n}\n\ncharge_mpesa = MobileMoney.new(payment)\n\nresponse = charge_mpesa.initiate_charge(payload)\nprint response\n\n#verify transaction \nresponse = charge_mpesa.verify_charge(response[\"data\"][\"tx_ref\"])\nprint response\n\n\n#zambia test\n\npayload = {\n    \"tx_ref\" =\u003e \"MC-158523s09v5050e8\",\n    \"amount\" =\u003e \"1500\",\n    \"currency\" =\u003e \"ZMW\",\n    \"network\" =\u003e \"MTN\",\n    \"email\" =\u003e \"xxxxxxxxxx@gmail.com\",\n    \"phone_number\" =\u003e \"054709929220\",\n    \"fullname\" =\u003e \"Test Name\"\n}\n\ncharge_zambia = MobileMoney.new(payment)\n\nresponse = charge_zambia.initiate_charge(payload)\nprint response\n\n#verify transaction\nresponse = charge_zambia.verify_charge(response[\"data\"][\"tx_ref\"])\nprint response\n\n\n# # Ghana mobile money test\npayload = {\n    \"tx_ref\" =\u003e \"MC-158523s09v5050e8\",\n    \"amount\" =\u003e \"150\",\n    \"currency\" =\u003e \"GHS\",\n    \"voucher\" =\u003e \"143256743\",\n    \"network\" =\u003e \"MTN\",\n    \"email\" =\u003e \"xxxxx@gmail.com\",\n    \"phone_number\" =\u003e  \"054709929220\",\n    \"fullname\": \"Test Name\"\n}\n\ncharge_ghana = MobileMoney.new(payment)\n\n#initiate transaction\nresponse = charge_ghana.initiate_charge(payload)\nprint response\n\n#verify transaction\nresponse = charge_ghana.verify_charge(response[\"data\"][\"tx_ref\"])\nprint response\n\n\n# Rwanda mobile money test\n\npayload = {\n    \"tx_ref\" =\u003e \"MC-158523s09v5050e8\",\n    \"amount\" =\u003e \"1500\",\n    \"currency\" =\u003e \"RWF\",\n    \"network\" =\u003e \"MTN\",\n    \"email\" =\u003e \"xxxxx@gmail.com\",\n    \"phone_number\" =\u003e \"054709929220\",\n    \"fullname\" =\u003e \"Test Name\"\n}\n\ncharge_rwanda = MobileMoney.new(payment)\n\nresponse = charge_rwanda.initiate_charge(payload)\nprint response\n\n# verify transaction\nresponse = charge_rwanda.verify_charge(response[\"data\"][\"tx_ref\"])\nprint response\n\n\n#uganda test\n\npayload = {\n    \"tx_ref\" =\u003e \"MC-1585230950500\",\n    \"amount\" =\u003e \"1500\",\n    \"email\" =\u003e \"xxxxxxxx@gmail.com\",\n    \"phone_number\" =\u003e \"054709929220\",\n    \"currency\" =\u003e \"UGX\",\n    \"redirect_url\" =\u003e \"https://rave-webhook.herokuapp.com/receivepayment\",\n    \"network\" =\u003e \"MTN\"\n\n}\n\ncharge_uganda = MobileMoney.new(payment)\n\nresponse = charge_uganda.initiate_charge(payload)\nprint response\n\nresponse = charge_uganda.verify_charge(response[\"data\"][\"tx_ref\"])\nprint response\n\n # franco phone\npayload = {\n    \"tx_ref\" =\u003e \"MC-1585230950501\",\n    \"amount\" =\u003e \"1500\",\n    \"email\" =\u003e \"xxxxxx@gmail.com\",\n    \"phone_number\" =\u003e \"054709929220\",\n    \"currency\" =\u003e \"XAF\",\n    \"redirect_url\" =\u003e \"https://rave-webhook.herokuapp.com/receivepayment\"\n\n}\n\ncharge_franco = MobileMoney.new(payment)\n\nresponse = charge_franco.initiate_charge(payload)\nprint response\n\n\nresponse = charge_franco.verify_charge(response[\"data\"][\"tx_ref\"])\nprint response\n```\n\n## Misc.new(payment)\n#### Its functions includes:\n\n_ .get_all_wallet_balance\n- .get_balance_per_currency\n- .resolve_account\n- .resolve_bvn\n- .resolve_card_bin\n\n## see full flow below\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxxx-X\", \"FLWSECK-xxxxx-X\", \"xxxxxxxxxxxxxxx\")\nmisc = Misc.new(payment)\n\n#get all wallet balance\nresponse = misc.get_all_wallet_balance\nprint response\n\n\n#get balance per cuurency\nresponse = misc.get_balance_per_currency(\"NGN\")\nprint response\n\n#resolve account\npayload = {\n    \"account_number\" =\u003e \"0690000032\",\n    \"account_bank\" =\u003e \"044\"\n}\nresponse = misc.resolve_account(payload)\n\nprint response\n\n#resolve bvn\nresponse = misc.resolve_bvn(\"12345678901\")\nprint response\n\n\n#resolve card bin\nresponse = misc.resolve_card_bin(553188)\nprint response\n\n```\n\n## Preauth.new(payment)\n#### Its functions includes:\n\n- .capture_preauth\n- .void_preauth\n- .refund_preauth\n\n## see full flow below\n\n```ruby\nrequire 'flutterwave_sdk'\n\n# This is a Flutterwave object which is expecting public, secret and encrption keys\npayment = Flutterwave.new(\"FLWPUBK-xxxxxxxxx-X\", \"xxxxxxxxxxxxxx\", \"xxxxxxxxxxxxxx\")\n\n# This is used to perform preauth capture\n\nauth = Preauth.new(payment)\n\npayload = {\n    \"amount\" =\u003e \"50\"\n}\n\nflw_ref = \"FLW-MOCK-d6b76a67a639dc124917b8957baa5278\"\n\nrepsonse = auth.capture_preauth(flw_ref, payload)\nprint response\n\n\n#Void\nresponse = auth.void_preauth(flw_ref)\nprint response\n\n\n#Refund\npayload = {\n    \"amount\" =\u003e \"30\"\n}\n\nflw_ref = \"FLW-MOCK-d6b76a67a639dc124917b8957baa5278\"\n\nresponse = auth.refund_preauth(flw_ref, payload)\nprint response\n\n\n```\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/Iphytech/flutterwave_sdk. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/Iphytech/flutterwave_sdk/blob/master/CODE_OF_CONDUCT.md).\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the FlutterwaveSdk project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Iphytech/flutterwave_sdk/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiphytech%2Fflutterwave-ruby-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiphytech%2Fflutterwave-ruby-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiphytech%2Fflutterwave-ruby-sdk/lists"}