Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions ChargeVerificationUtils.md
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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:
Expand All @@ -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);
```

Expand Down
55 changes: 28 additions & 27 deletions CustomUiImplementation.md
Original file line number Diff line number Diff line change
@@ -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()
Expand Down Expand Up @@ -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`<br/><br/>Optional overloads:<br/>`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<Meta>`) | Pass in any other custom data you wish to pass. It takes in a `List` of `Meta` objects | List<Meta> | Not Required
| setSubAccounts(`List<SubAccount>`) | 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<SubAccount>`| 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`<br/><br/>Optional overloads:<br/>`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<Meta>`) | Adds custom data to be passed. It accepts a `List` of `Meta` objects | List<Meta> | Not Required
| setSubAccounts(`List<SubAccount>`) | 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<SubAccount>`| 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
</details>

### 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);
Expand All @@ -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`.
<details>
<summary>See Example</summary>

Expand Down Expand Up @@ -140,14 +141,14 @@ We have predefined callback classes for each payment method. Make your Fragment/
| Zambia Mobile Money | `ZmMobileMoneyPaymentManager` | `ZmMobileMoneyPaymentCallback`
</details>

> 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
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -245,7 +246,7 @@ public class PaymentActivity extends AppCompatActivity implements SavedCardsList

@Override
public void onCardSaveSuccessful(String phoneNumber) {
//card saved successful
//card saved successfully
}

@Override
Expand Down
Loading