diff --git a/ChargeVerificationUtils.md b/ChargeVerificationUtils.md index dffe5fc0..0e417f87 100644 --- a/ChargeVerificationUtils.md +++ b/ChargeVerificationUtils.md @@ -1,7 +1,7 @@ # Charge Verification Utils -This module helps you handle charge verification when not using the default drop-in UI provided by Flutterwave's android SDK. +This module helps you in handling charge verification when you are not using the default drop-in UI provided by Flutterwave's Android SDK. -**Step 1.** Add this in your root build.gradle at the end of repositories: +**Step 1.** Add the following to your root build. gradle file at the end of the `repositories` section: allprojects { repositories { @@ -10,22 +10,22 @@ This module helps you handle charge verification when not using the default drop } } -**Step 2.** Add the dependency for the utils library +**Step 2.** Add the dependency for the utils library: dependencies { implementation 'com.github.Flutterwave.rave-android:rave_utils:2.1.39' } -**Step 2.** In your payment activity or fragment, create an instance of the `RaveVerificationUtils` class +**Step 2.** In your payment activity or fragment, create an instance of the `RaveVerificationUtils` class. RaveVerificationUtils verificationUtils = new RaveVerificationUtils(contextProvider, isStaging, publicKey, theme); ##### Parameter definitions | Parameter Name | Description | Type | Required | | ------------- |:-------------:| -----:| -----:| -| contextProvider | This is the application or fragment class where you're handling the charge verification. | `Activity` or `Fragment` | Required -| isStaging | Specifies whether it's the staging or live environment. | `Boolean` | Required -| publicKey | Your Flutterwave account's public key. | `String` | Required +| contextProvider | This is the application or fragment class handling charge verification. | `Activity` or `Fragment` | Required +| isStaging | This specifies if the environment is test or live. | `Boolean` | Required +| publicKey | Your Flutterwave public key. | `String` | Required | theme | Reference to your custom style. | `int` | Not required **Step 3** You can call the verification class for these scenarios: @@ -35,12 +35,12 @@ This module helps you handle charge verification when not using the default drop verificationUtils.showPinScreen(); // For OTP collection -verificationUtils.showOtpScreen(instructionToBeDisplayed); // instruction parameter is optional +verificationUtils.showOtpScreen(instructionToBeDisplayed); // The instruction parameter is optional // For Address collection verificationUtils.showAddressScreen(); -// For Authentication webpage display +// For the Authentication webpage display verificationUtils.showWebpageVerificationScreen(authUrl); ``` diff --git a/CustomUiImplementation.md b/CustomUiImplementation.md index 41ccd950..a384ee64 100644 --- a/CustomUiImplementation.md +++ b/CustomUiImplementation.md @@ -1,8 +1,8 @@ # Custom UI Implementation -The Flutterwave SDK can be used with your custom UI where you handle the entire User Interface. This doc shows how to do so. +The Flutterwave SDK can be integrated with your custom UI, allowing you to manage the entire User Interface. This section guides you on how to implement this. ### 1. Create a `RaveNonUIManager` instance -Set the public key, encryption key and other required parameters. +Begin by creating an instance of `RaveNonUIManager` and setting the public and encryption key, along with other required parameters. RaveNonUIManager raveNonUIManager = new RaveNonUIManager() @@ -30,26 +30,27 @@ Set the public key, encryption key and other required parameters. | Function | Parameter | Type | Required | | ------------- |:-------------:| -----:| -----:| -| setAmount(amount) | This is the amount to be charged from card/account | `double` | Required -| setCurrency(currency) | This is the specified currency to charge the card in | `String` | Required -| setfName(fName) | This is the first name of the card holder or the customer | `String` | Required -| setlName(lName) | This is the last name of the card holder or the customer | `String` | Required -| setEmail(email) | This is the email address of the customer | `String` | Required -| setNarration(narration) | This is a custom description added by the merchant. For `Bank Transfer` payments, this becomes the account name of the account to be paid into. See more details [here](https://developer.flutterwave.com/v2.0/reference#pay-with-bank-transfer-nigeria). | `String` | Not Required -| setPublicKey(publicKey) | Merchant's public key. Get your merchant keys here for [ staging](https://flutterwavedevelopers.readme.io/blog/how-to-get-your-staging-keys-from-the-rave-sandbox-environment) and [live](https://flutterwavedevelopers.readme.io/blog/how-to-get-your-live-keys-from-the-rave-dashboard)| `String` | Required -| setEncryptionKey(encryptionKey) | Merchant's encryption key. Get your merchant keys here for [ staging](https://flutterwavedevelopers.readme.io/blog/how-to-get-your-staging-keys-from-the-rave-sandbox-environment) and [live](https://flutterwavedevelopers.readme.io/blog/how-to-get-your-live-keys-from-the-rave-dashboard) | `String` | Required -| setTxRef(txRef) | This is the unique reference, unique to the particular transaction being carried out. It is generated by the merchant for every transaction | `String` | Required -| setPhoneNumber(phoneNumber) | This sets the customer's phone number. This functions is also overloaded to allow you specify whether the customer can edit their phone number as such: `setPhoneNumber(phoneNumber,false)`. When set to false, the user will not be able to change the number you set here.| `String`

Optional overloads:
`String`, `boolean` | Not Required -| onStagingEnv(boolean) | Set to `true` if you want your transactions to run in the staging environment otherwise set to `false`. Defaults to false | `boolean` | Not Required -| setMeta(`List`) | Pass in any other custom data you wish to pass. It takes in a `List` of `Meta` objects | List | Not Required -| setSubAccounts(`List`) | Pass in a `List` of `SubAccount`,if you want to split transaction fee with other people. Subaccounts are your vendors' accounts that you want to settle per transaction. To initialize a `SubAccount` class, do `SubAccount(String subAccountId,String transactionSplitRatio)` or `SubAccount(String subAccountId,String transactionSplitRatio,String transactionChargeType, String transactionCharge)` to also charge the subaccount a fee. [Learn more about split payments and subaccounts](https://developer.flutterwave.com/docs/split-payment).| `List`| Not Required -| setIsPreAuth(boolean) | Set to `true` to preauthorise the transaction amount. [Learn more about preauthourization](https://developer.flutterwave.com/v2.0/reference#introduction-1). | `int` | Not Required -| setPaymentPlan(payment_plan) | If you want to do recurrent payment, this is the payment plan ID to use for the recurring payment, you can see how to create payment plans [here](https://flutterwavedevelopers.readme.io/v2.0/reference#create-payment-plan) and [here](https://flutterwavedevelopers.readme.io/docs/recurring-billing). This is only available for card payments | `String` | Not Required -| initialize() | Returns the prepared `RaveNonUiManager` that can be used with any of the payment managers for the different payment methods | N/A | Required +| setAmount(amount) | This sets the amount to be charged from the customer. | `double` | Required +| setCurrency(currency) | This sets the specified currency to charge the customer in. | `String` | Required +| setfName(fName) | This sets the first name of the customer. | `String` | Required +| setlName(lName) | This sets the last name of the customer. | `String` | Required +| setEmail(email) | This sets the email address of the customer. | `String` | Required +| setNarration(narration) | This sets a custom description added by the merchant. For `Bank Transfer` payments, this will be shown to the customer as the account name when the account number is resolved. | `String` | Not Required +| setPublicKey(publicKey) | This sets the Merchant's public key. Get your live and test public key from your dashboard [here](https://app.flutterwave.com/login). For further information on how to retrieve your keys, visit [here](https://flutterwave.com/gh/support/my-account/getting-your-api-keys).| `String` | Required +| setEncryptionKey(encryptionKey) | This sets the Merchant's encryption key. Get your live and test encryption key from your dashboard [here](https://dashboard.flutterwave.com/login). For further information on how to retrieve your keys, visit [here](https://flutterwave.com/gh/support/my-account/getting-your-api-keys). | `String` | Required +| setTxRef(txRef) | This is the unique reference, specific to the particular transaction being carried out. This should be generated for each transaction. | `String` | Required +| setPhoneNumber(phoneNumber) | This sets the customer's phone number. This function has an overload to specify whether the customer can edit their phone number: `setPhoneNumber(phoneNumber, false)`. When set to false, the customer is unable to change the phone number provided.| `String`

Optional overloads:
`String`, `boolean` | Not Required +| onStagingEnv(boolean) | Set to `true` to carry out test transactions in the staging environment; otherwise, the default value +is `false`. | `boolean` | Not Required +| setMeta(`List`) | Adds custom data to be passed. It accepts a `List` of `Meta` objects | List | Not Required +| setSubAccounts(`List`) | Accepts a `List` of `SubAccount`, if you want to split the transaction fee with other accounts. Subaccounts are vendors' accounts to be settled per transaction. To initialize a `SubAccount` class, use `SubAccount(String subAccountId, String transactionSplitRatio)` or `SubAccount(String subAccountId, String transactionSplitRatio, String transactionChargeType, String transactionCharge)` to also charge the subaccount a fee. [Learn more about split payments and subaccounts](https://flutterwave.com/eg/support/payments/split-payments-with-sub-accounts).| `List`| Not Required +| setIsPreAuth(boolean) | Set to `true` to preauthorise the transaction amount. [Learn more about preauthourization](https://flutterwave.com/ci/blog/a-developers-guide-to-implementing-card-pre-authorization-charges-with-flutterwave). | `int` | Not Required +| setPaymentPlan(payment_plan) | If you want to set up recurrent payments, this is the payment plan ID to use. For guidance on creating payment plans, visit [here](https://flutterwave.com/gb/support/my-account/creating-and-cancelling-payment-plans). Recurring payment is only available for card payments | `String` | Not Required +| initialize() | Returns the prepared `RaveNonUiManager` that can be used with any of the payment managers for the different payment methods. | N/A | Required ### 2. Initiate a charge -Use the payment method's manager to initiate a charge. For example to charge cards, use the `CardPaymentManager`. (Store the Payment Manager object in a variable to be able to access it in the next steps). +Use the payment method's manager to initiate a charge. For example, to charge cards, use the `CardPaymentManager`. (Store the Payment Manager object in a variable to be able to access it in the next steps.) CardPaymentManager cardPayManager = new CardPaymentManager( raveNonUIManager, CardPaymentCallback, SavedCardsListener); @@ -63,7 +64,7 @@ Use the payment method's manager to initiate a charge. For example to charge car cardPayManager.chargeCard(card); ### 3. Implement callbacks -We have predefined callback classes for each payment method. Make your Fragment/Activity (or other class handling the payment interaction) implement the specified callback for the payment method you'd like to use, and override the specified callback functions. For example to charge cards, implement the `CardPaymentCallback` +We have predefined callback classes for each payment method. Make your Fragment/Activity (or other class handling the payment interaction) implement the specified callback for the payment method you'd like to use, and override the specified callback functions. For example, to charge cards, implement the `CardPaymentCallback`.
See Example @@ -140,14 +141,14 @@ We have predefined callback classes for each payment method. Make your Fragment/ | Zambia Mobile Money | `ZmMobileMoneyPaymentManager` | `ZmMobileMoneyPaymentCallback`
-> We worked on a module to simplify charge verification when using the No-UI approach. You can read about using it [here](ChargeVerificationUtils.md) +> We worked on a module to simplify charge verification when using the No-UI approach. You can read about using it [here](ChargeVerificationUtils.md). > Due to the multiple payment methods available, all the methods of the different payment callback classes could not be documented here. Please refer to the individual Javadocs in the code if clarification is needed. -> To see a more practical way of using the sdk, head to our sample app in the repository [here](https://github.com/Flutterwave/rave-android/tree/master/app) +> To see a more practical way of using the SDK, head to our sample app in the repository [here](https://github.com/Flutterwave/rave-android/tree/master/app). -## Configuring Proguard -To configure Proguard, add the following lines to your proguard configuration file. These will keep files related to this sdk +## Configuring ProGuard +To configure ProGuard, add the following lines to your ProGuard configuration file. This will keep files related to this SDK. ``` keepclasseswithmembers public class com.flutterwave.raveandroid.** { *; } dontwarn com.flutterwave.raveandroid.card.CardFragment @@ -178,7 +179,7 @@ public class PaymentActivity extends AppCompatActivity // Methods to override @Override public void onTransactionFeeFetched(String chargeAmount, String fee) { - // Display the fee to the customer then proceed to payment at your + // Display the fee to the customer, then proceed to payment at your // discretion using cardPayManager.chargeCard(card); } @@ -210,7 +211,7 @@ public class PaymentActivity extends AppCompatActivity implements SavedCardsList //... //... - // To save a card call `CardPaymentManager.saveCard()` after a card payment is successful (before starting another payment). + // To save a card, call `CardPaymentManager.saveCard()` after a card payment is successful (before starting another payment). /** * Fetch the user's saved cards. The overridden functions will be called as applicable. @@ -245,7 +246,7 @@ public class PaymentActivity extends AppCompatActivity implements SavedCardsList @Override public void onCardSaveSuccessful(String phoneNumber) { - //card saved successful + //card saved successfully } @Override diff --git a/README.md b/README.md index 51b1bbf5..1004af16 100644 --- a/README.md +++ b/README.md @@ -4,24 +4,54 @@ # Flutterwave Android SDK -Flutterwave's Android SDK can be used to integrate the Flutterwave payment gateway into your android app. It comes with a ready-made Drop In UI and non-UI module, depending on your preference. +Flutterwave's Android SDK allows you to integrate the Flutterwave payment gateway into your Android application. It comes with a ready-made drop-in UI as well as a non-UI module, depending on your preference. -The payment methods currently supported are Cards, USSD, Mpesa, GH Mobile Money, UG Mobile Money, ZM Mobile Money, Rwanda Mobile Money, Franc Mobile Money, US ACH, UK Bank, SA Bank, Nigeria Bank Account, Nigeria Bank Transfer, Barter Mobile Wallet. +Currently, the payment methods supported are: + +Cards, + +USSD, + +Mpesa, + +GH Mobile Money, + +UG Mobile Money, + +ZM Mobile Money, + +Rwanda Mobile Money, + +Franc Mobile Money, + +US ACH, + +UK Bank, + +SA Bank, + +Nigeria Bank Account, + +Nigeria Bank Transfer, + +Barter Mobile Wallet. Screenshot of Drop-In ## Before you begin -- Ensure you have your test (and live) [API keys](https://developer.flutterwave.com/docs/api-keys). -- The use of this SDK means you have signed up on Flutterwave and have accepted Flutterwave's [terms and conditions](https://flutterwave.com/us/terms) and [privacy policy](https://flutterwave.com/us/privacy-policy). +- Ensure you have your test and live API keys. You can find more information about retrieving your keys [here](https://flutterwave.com/gh/support/my-account/getting-your-api-keys). +- By using this SDK, you confirm that you have signed up on Flutterwave and accepted our [terms and conditions](https://flutterwave.com/us/terms) as well as our [privacy policy](https://flutterwave.com/us/privacy-policy). ## Requirements -- The minimum supported SDK version is 15 -- Rave android sdk 1.0.50 and above only supports projects that have been migrated to [androidx](https://developer.android.com/jetpack/androidx/). For more information, read Google's [migration guide](https://developer.android.com/jetpack/androidx/migrate). +- The minimum supported SDK version is 15. +- Note that Rave Android SDK version 1.0.50 and above only supports projects that have been migrated to [androidx](https://developer.android.com/jetpack/androidx/). For more information, please refer to Google's [migration guide](https://developer.android.com/jetpack/androidx/migrate). ## Adding it to your project -**Step 1.** Add it in your root build.gradle at the end of repositories: +**Step 1.** Add the JitPack Repository: +Include the JitPack repository in your root `build.gradle` file by adding the following lines at the end of the `repositories` section: + ```groovy allprojects { repositories { @@ -30,33 +60,34 @@ The payment methods currently supported are Cards, USSD, Mpesa, GH Mobile Money, } } ``` -**Step 2.** Add the dependency +**Step 2.** Include the dependency -If you want to use the default Drop In UI, add the `rave-android` module dependency +To use the default Drop In UI, add the `rave-android` module dependency. ```groovy dependencies { implementation 'com.github.flutterwave.rave-android:rave_android:2.2.1' } ``` -if you are not interested in our default UI and you want to use yours and only want to interact with our core sdk, use the `rave_presentation` module +If you prefer to use your own custom UI and only want to interact with our core SDK, use the `rave_presentation` module instead. ```groovy dependencies { implementation 'com.github.Flutterwave.rave-android:rave_presentation:2.2.1' } ``` -**Step 3.** Add the `INTERNET` permission to your android manifest +**Step 3.** Add the `INTERNET` permission. +Make sure to include the `INTERNET` permission in your Android manifest by adding the following line: -> The steps below show how to use the Flutterwave Android SDK as a Drop-in UI (all the views for the payment process are handled by the SDK). If you would like to use your own custom UI instead, please see the continuation [here](CustomUiImplementation.md). +> The steps outlined below guide you on how to utilize the Flutterwave Android SDK as a Drop-in UI, where all the views for the payment process are handled by the SDK. If you wish to implement your own custom UI, please refer to the additional instructions provided [here](CustomUiImplementation.md). ## Usage ### For using the default UI ### 1. Create a `RaveUiManager` instance -Set the public key, encryption key and other required parameters. The `RaveUiManager` accepts a mandatory instance of the calling `Activity` (or a `Fragment` that has a parent activity). +Configure your Public and Encryption key, along with other required parameters. The `RaveUiManager` requires a mandatory instance of the calling `Activity`, or a `Fragment` associated with a parent activity. new RaveUiManager(activity).setAmount(amount) .setCurrency(currency) @@ -99,55 +130,55 @@ Set the public key, encryption key and other required parameters. The `RaveUiMan | Function | Parameter | Type | Required | | ------------- |:-------------:| -----:| -----:| -| setAmount(amount) | This is the amount to be charged from card/account | `double` | Required -| setCurrency(currency) | This is the specified currency to charge the card in | `String` | Required -| setfName(fName) | This is the first name of the card holder or the customer | `String` | Required -| setlName(lName) | This is the last name of the card holder or the customer | `String` | Required -| setEmail(email) | This is the email address of the customer | `String` | Required -| setNarration(narration) | This is a custom description added by the merchant. For `Bank Transfer` payments, this becomes the account name of the account to be paid into. See more details [here](https://developer.flutterwave.com/v2.0/reference#pay-with-bank-transfer-nigeria). | `String` | Not Required -| setPublicKey(publicKey) | Merchant's public key. Get your merchant keys here for [ staging](https://flutterwavedevelopers.readme.io/blog/how-to-get-your-staging-keys-from-the-rave-sandbox-environment) and [live](https://flutterwavedevelopers.readme.io/blog/how-to-get-your-live-keys-from-the-rave-dashboard)| `String` | Required -| setEncryptionKey(encryptionKey) | Merchant's encryption key. Get your merchant keys here for [ staging](https://flutterwavedevelopers.readme.io/blog/how-to-get-your-staging-keys-from-the-rave-sandbox-environment) and [live](https://flutterwavedevelopers.readme.io/blog/how-to-get-your-live-keys-from-the-rave-dashboard) | `String` | Required -| setTxRef(txRef) | This is the unique reference, unique to the particular transaction being carried out. It is generated by the merchant for every transaction | `String` | Required -| setPhoneNumber(phoneNumber) | This sets the customer's phone number. This functions is also overloaded to allow you specify whether the customer can edit their phone number as such: `setPhoneNumber(phoneNumber,false)`. When set to false, the user will not be able to change the number you set here.| `String`

Optional overloads:
`String`, `boolean` | Not Required -| acceptAccountPayments(boolean) | Set to `true` if you want to accept payments via bank accounts, else set to `false`. | `boolean` | Not Required -| acceptCardPayments(boolean) | Set to `true` if you want to accept payments via cards, else set to `false` | `boolean` | Not Required | -| acceptMpesaPayments(boolean) | Set to `true` if you want to accept Mpesa payments, else set to `false` . For this option to work, you should set your country to `KE` and your currency to `KES` | `boolean` | Not Required | -| acceptGHMobileMoneyPayments(boolean) | Set to `true` if you want to accept Ghana mobile money payments, else set to `false` . For this option to work, you should set your country to `GH` and your currency to `GHS`| `boolean` | Not Required | -| acceptUgMobileMoneyPayments(boolean) | Set to `true` if you want to accept Uganda mobile money payments, else set to `false` . For this option to work, you should set your country to `UG` and your currency to `UGX`| `boolean` | Not Required | -| acceptZmMobileMoneyPayments(boolean) | Set to `true` if you want to accept Zambia mobile money payments, else set to `false` . For this option to work, you should set your country to `NG` and your currency to `ZMW`. `MTN` is the only available network at the moment, see more details in the [API documentation](https://developer.flutterwave.com/reference#zambia-mobile-money).| `boolean` | Not Required | -| acceptRwfMobileMoneyPayments(boolean) | Set to `true` if you want to accept Rwanda mobile money payments, else set to `false` . For this option to work, you should set your country to `NG` and your currency to `RWF`. See more details in the [API documentation](https://developer.flutterwave.com/reference#rwanda-mobile-money).| `boolean` | Not Required | -| acceptSaBankPayments(boolean) | Set to `true` if you want to accept South African direct bank account payments, else set to `false` . For this option to work, you should set your country to `ZA` and your currency to `ZAR`.| `boolean` | Not Required | -| acceptUkPayments(boolean) | Set to `true` if you want to accept UK Bank Account payments, else set to `false` . For this option to work, you should set your country to `NG`, set currency to `GBP`, set accountbank `String`, set accountname `String`, set accountnumber `String`, set is_uk_bank_charge2 `true`, set payment_type `account`. `Please use your live credentials for this` | `boolean` | Not Required | -| acceptAchPayments(boolean) | Set to `true` if you want to accept US ACH charges from your customers, else set to `false` . For this option to work, you should set your country to `US` and your currency to `USD`. You also have to set `acceptAccountPayments(true)`| `boolean` | Not Required | -| acceptBankTransferPayments(boolean) | Set to `true` if you want to accept payments via bank transfer from your customers, else set to `false`. This option is currently only available for Nigerian Naira.

Note: By default, the account numbers generated are dynamic. This method has been overloaded for more options as shown below:
  • To generate static (permanent) accounts instead, pass in `true` as a second parameter. E.g.
    ```acceptBankTransferPayments(true, true)```
  • To generate accounts that expire at a certain date, or after a certain number of payments, pass in integer values for `duration` and `frequency` as such:
    ```acceptBankTransferPayments(true, duration, frequency)```
You can get more details in the [API documentation](https://developer.flutterwave.com/v2.0/reference#pay-with-bank-transfer-nigeria).| `boolean`

Optional overloads:
`boolean`, `boolean`

`boolean`, `int`, `int` | Not Required | -| acceptUssdPayments(boolean) | Set to `true` if you want to accept payments via USSD transfer from your customers, else set to `false` . This option is currently only available for the Nigerian Naira.| `boolean` | Not Required | -| acceptBarterPayments(boolean) | Set to `true` if you want to accept payments via Barter from your customers, else set to `false`.| `boolean` | Not Required | -| acceptFrancMobileMoneyPayments(boolean) | Set to `true` if you want to accept Francophone mobile money payments, else set to `false` . For this option to work, you should set your country to `NG` and your currency to `XOF` for West African CFA franc like `Ivory Coast` OR `XAF` for Central African CFA franc like `Cameroon` . See more details in the [API documentation](https://developer.flutterwave.com/reference#mobile-money-francophone).| `boolean` | Not Required | -| allowSaveCardFeature(boolean) | Set to `true` if you want to give the user the option to save their cards for future transactions. This option helps them avoid retyping their card details for every transaction. Defaults to `true`.| `boolean` | Not Required | -| onStagingEnv(boolean) | Set to `true` if you want your transactions to run in the staging environment otherwise set to `false`. Defaults to false | `boolean` | Not Required -| setMeta(`List`) | Pass in any other custom data you wish to pass. It takes in a `List` of `Meta` objects | List | Not Required -| setSubAccounts(`List`) | Pass in a `List` of `SubAccount`,if you want to split transaction fee with other people. Subaccounts are your vendors' accounts that you want to settle per transaction. To initialize a `SubAccount` class, do `SubAccount(String subAccountId,String transactionSplitRatio)` or `SubAccount(String subAccountId,String transactionSplitRatio,String transactionChargeType, String transactionCharge)` to also charge the subaccount a fee. [Learn more about split payments and subaccounts](https://developer.flutterwave.com/docs/split-payment).| `List`| Not Required -| setIsPreAuth(boolean) | Set to `true` to preauthorise the transaction amount. [Learn more about preauthourization](https://developer.flutterwave.com/v2.0/reference#introduction-1). | `int` | Not Required +| setAmount(amount) | This sets the amount to be charged from the customer. | `double` | Required +| setCurrency(currency) | This specifies the currency to charge the customer in. | `String` | Required +| setfName(fName) | This sets the first name of the customer. | `String` | Required +| setlName(lName) | This sets the last name of the customer. | `String` | Required +| setEmail(email) | This sets the email address of the customer. | `String` | Required +| setNarration(narration) | This adds a custom description provided by the merchant. For `Bank Transfer` payments, this will be shown to the customer as the account name when the account number is resolved. | `String` | Not Required +| setPublicKey(publicKey) | This sets the Merchant's public key. Get your Live and Test keys from your [dashboard](http://dashboard.flutterwave.com/).| `String` | Required +| setEncryptionKey(encryptionKey) |This sets the Merchant's encryption key. Get your Live and Test keys from your [dashboard](http://dashboard.flutterwave.com/). | `String` | Required +| setTxRef(txRef) | This sets the unique reference for the specific transaction being carried out. It is generated by the merchant for each transaction. | `String` | Required +| setPhoneNumber(phoneNumber) | This sets the customer's phone number. This function has an overload to specify whether the customer can edit their phone number: `setPhoneNumber(phoneNumber, false)`. When set to false, the customer is unable to change the phone number provided.| `String`

Optional overloads:
`String`, `boolean` | Not Required +| acceptAccountPayments(boolean) | Set to `true` if you want to accept payments via bank accounts; otherwise set to `false`. | `boolean` | Not Required +| acceptCardPayments(boolean) | Set to `true` if you want to accept payments via cards, otherwise set to `false`. | `boolean` | Not Required | +| acceptMpesaPayments(boolean) | Set to `true` if you want to accept Mpesa payments; otherwise set to `false`. To use this payment option, you must set the country to `KE` and the currency to `KES`. | `boolean` | Not Required | +| acceptGHMobileMoneyPayments(boolean) | Set to `true` if you want to accept Ghana mobile money payments; otherwise set to `false`. To use this payment option, you must set the country to `GH` and the currency to `GHS`. | `boolean` | Not Required | +| acceptUgMobileMoneyPayments(boolean) | Set to `true` if you want to accept Uganda mobile money payments; otherwise set to `false`. To use this payment option, set the country to `UG` and the currency to `UGX`.| `boolean` | Not Required | +| acceptZmMobileMoneyPayments(boolean) | Set to `true` if you want to accept Zambia mobile money payments; otherwise set to `false`. To use this payment option, set the country to `NG` and the currency to `ZMW`. `MTN` is the only available network at the moment.| `boolean` | Not Required | +| acceptRwfMobileMoneyPayments(boolean) | Set to `true` if you want to accept Rwanda mobile money payments; otherwise set to `false`. To use this payment option, you should set the country to `NG` and the currency to `RWF`.| `boolean` | Not Required | +| acceptSaBankPayments(boolean) | Set to `true` if you want to accept South African direct bank account payments; otherwise set to `false`. To use this payment option, you should set the country to `ZA` and the currency to `ZAR`.| `boolean` | Not Required | +| acceptUkPayments(boolean) | Set to `true` if you want to accept UK Bank Account payments; otherwise set to `false`. To use this payment option, you should set the country to `NG` and the currency to `GBP`, and provide the bank account information, including `accountBank` (String), `accountName` (String), and `accountNumber` (String). Additionally, set `is_uk_bank_charge` to `true` and `payment_type` to `account`. `Please ensure you use your live credentials for this. ' | `boolean` | Not Required | +| acceptAchPayments(boolean) | Set to `true` if you want to accept US ACH charges from your customers; otherwise set to `false`. To use this payment option, you should set the country to `US` and the currency to `USD`. You also need to set `acceptAccountPayments(true)` to true.| `boolean` | Not Required | +| acceptBankTransferPayments(boolean) | Set to `true` if you want to accept payments via bank transfer from your customers; otherwise set to `false`. This payment option is currently only available for the NGN currency.

Note: By default, the account numbers generated are dynamic. This method has been overloaded with additional options as shown below:
  • To generate static (permanent) accounts instead, pass in `true` as a second parameter. E.g.
    ```acceptBankTransferPayments(true, true)```
  • To generate dynamic accounts that expire at a certain date, or after a set number of payments, provide integer values for `duration` and `frequency`, like so:
    ```acceptBankTransferPayments(true, duration, frequency)```
| `boolean`

Optional overloads:
`boolean`, `boolean`

`boolean`, `int`, `int`.| Not Required | +| acceptUssdPayments(boolean) | Set to `true` if you want to accept payments via USSD transfer from your customers, otherwise set to `false`. This payment option is currently only available for the NGN currency.| `boolean` | Not Required | +| acceptBarterPayments(boolean) | Set to `true` if you want to accept payments via Barter from your customers; otherwise set to `false`.| `boolean` | Not Required | +| acceptFrancMobileMoneyPayments(boolean) | Set to `true` if you want to accept Francophone mobile money payments from your customers; otherwise set to `false`. To use this payment option, you should set the country to `NG` and the currency to `XOF` for West African CFA franc, like `Ivory Coast`, OR `XAF` for Central African CFA franc, like `Cameroon`.| `boolean` | Not Required | +| allowSaveCardFeature(boolean) | Set to `true` if you wish to give the customer the option of saving their cards for future use. This option helps them avoid retyping their card details for every transaction. By default, this is set to `true`.| `boolean` | Not Required | +| onStagingEnv(boolean) | Set to `true` if you want to perform test transactions in the test environment; otherwise set to `false`. The Default value to false. | `boolean` | Not Required +| setMeta(`List`) | Pass in any other custom data you wish to pass. It takes in a `List` of `Meta` objects. | List | Not Required +| setSubAccounts(`List`) | Pass in a `List` of `SubAccount`, if you want to split the transaction fee with other people. Subaccounts are your vendors' accounts that you want to settle per transaction. To initialize a `SubAccount` class, do `SubAccount(String subAccountId, String transactionSplitRatio)` or `SubAccount(String subAccountId, String transactionSplitRatio, String transactionChargeType, String transactionCharge)` to also charge the subaccount a fee. [Learn more about split payments and subaccounts](https://flutterwave.com/eg/support/payments/split-payments-with-sub-accounts).| `List`| Not Required +| setIsPreAuth(boolean) | Set to `true` to preauthorise the transaction amount. [Learn more about preauthourization](https://flutterwave.com/ci/blog/a-developers-guide-to-implementing-card-pre-authorization-charges-with-flutterwave). | `int` | Not Required | withTheme(styleId) | Sets the theme of the UI. | `int` | Not Required -| setPaymentPlan(payment_plan) | If you want to do recurrent payment, this is the payment plan ID to use for the recurring payment, you can see how to create payment plans [here](https://flutterwavedevelopers.readme.io/v2.0/reference#create-payment-plan) and [here](https://flutterwavedevelopers.readme.io/docs/recurring-billing). This is only available for card payments | `String` | Not Required -| shouldDisplayFee(boolean) | Set to `false` to not display a dialog for confirming total amount(including charge fee) that Rave will charge. By default this is set to `true` | `boolean` | Not Required -| showStagingLabel(boolean) | Set to `false` to not display a staging label when in staging environment. By default this is set to `true` | `boolean` | Not Required -| initialize() | Launch the Rave Payment UI for when using the UI module, | N/A | Required +| setPaymentPlan(payment_plan) | If you want to set up recurring payments, the ID set here is the payment plan ID that will be used for the recurring charges. You can learn how to create payment plans [here](https://flutterwave.com/gb/support/my-account/creating-and-cancelling-payment-plans). Recurring payments are only available for card payments. | `String` | Not Required +| shouldDisplayFee(boolean) | Set to `false` to disable the dialog box for confirming the total amount charged by Flutterwave, including the charge fee. By default, this is set to `true`. | `boolean` | Not Required +| showStagingLabel(boolean) | Set to `false` to disable the staging label displayed in the test environment. By default, this is set to `true`. | `boolean` | Not Required +| initialize() | Launch the Flutterwave Payment UI when using the UI module. | N/A | Required -> Note: The order in which you call the methods for accepting different payment types is the order in which they will show in the UI. +> Note: The order in which you call the methods for accepting different payment types determines the display order in the UI. -> To see a more practical way of using the sdk, head to our sample app in the repository [here](https://github.com/Flutterwave/rave-android/tree/master/app) +> To see a more practical way of using the SDK, head to our sample app in the repository [here](https://github.com/Flutterwave/rave-android/tree/master/app) ### 2. Handle the response -In the calling activity, override the `onActivityResult` method to receive the payment response as shown below +In the calling activity, override the `onActivityResult` method to receive the payment response, as shown below: ```java @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { /* - * We advise you to do a further verification of transaction's details on your server to be - * sure everything checks out before providing service or goods. + * We advise you to do a further verification of the transaction's details on your server to be + * Be sure everything checks out before providing service or goods. */ if (requestCode == RaveConstants.RAVE_REQUEST_CODE && data != null) { String message = data.getStringExtra("response"); @@ -168,16 +199,15 @@ In the calling activity, override the `onActivityResult` method to receive the p ``` -The intent's `message` object contains the raw JSON response from the Rave API. This can be parsed to retrieve any additional payment information needed. Typical success response can be found [here](https://gist.github.com/bolaware/305ef5a6df7744694d9c35787580a2d2) and failed response [here](https://gist.github.com/bolaware/afa972cbca782bbb942984ddec9f5262). +The intent's `message` object contains the raw JSON response from Flutterwave's API. This can be parsed to retrieve any additional payment information needed. A Typical success response can be found [here](https://gist.github.com/bolaware/305ef5a6df7744694d9c35787580a2d2) and a failed response found [here](https://gist.github.com/bolaware/afa972cbca782bbb942984ddec9f5262). > **PLEASE NOTE** -> We advise you to do a further verification of transaction's details on your server to be - sure everything checks out before providing service or goods. +> We strongly advise you to verify the transaction's details on your server to ensure accuracy before providing goods or services. ### 3. Customize the look -You can apply a new look by changing the color of certain parts of the UI to highlight your brand colors. +You can customize the UI by changing the color of certain elements to reflect your brand colors. -First specify the theme in your `styles.xml` file. In this theme, you can edit the style for each of the elements you'd like to style, like the pay button, OTP button, etc. +First, specify the theme in your `styles.xml` file. In this theme, you can edit the styles for each of the elements you'd like to modify, such as the pay button, OTP button, etc. ```XML ``` - Then in your RavePayManager setup, add `.withTheme()` anywhere before calling the `initialize()` function. e.g. + Then, in your RavePayManager setup, add `.withTheme()` anywhere before calling the `initialize()` function. + For example: ```java new RavePayManager(activity).setAmount(amount) //... @@ -203,11 +234,11 @@ First specify the theme in your `styles.xml` file. In this theme, you can edit t .withTheme(R.Style.MyCustomTheme) .initialize(); ``` -> There is a limit to which the drop-in UI can be customized. For further customization, see our Custom UI implemetation guide [here](CustomUiImplementation.md). +> Be aware that there is a limit to how much you can customize the drop-in UI. For further customizations, refer to our Custom UI implementation guide [here](CustomUiImplementation.md). -## Configuring Proguard -To configure Proguard, add the following lines to your proguard configuration file. These will keep files related to this sdk +## Configuring ProGuard +To configure ProGuard, add the following lines to your ProGuard configuration file. These lines will keep the files related to this SDK. ``` keepclasseswithmembers public class com.flutterwave.raveandroid.** { *; } dontwarn com.flutterwave.raveandroid.card.CardFragment @@ -221,7 +252,7 @@ dontwarn com.flutterwave.raveandroid.card.CardFragment ## Want to contribute? -Feel free to create issues and pull requests. The more concise the pull requests the better :) +Feel free to create issues and pull requests. The more concise the pull requests, the better :) ## License @@ -234,7 +265,7 @@ Copyright (c) 2020 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights +in the Software without restriction, including, without limitation, the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: @@ -245,8 +276,8 @@ copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ```