diff --git a/BazaarPay/src/main/java/ir/cafebazaar/bazaarpay/StartBazaarPay.kt b/BazaarPay/src/main/java/ir/cafebazaar/bazaarpay/StartBazaarPay.kt
index 0f174d84..972c8d2d 100644
--- a/BazaarPay/src/main/java/ir/cafebazaar/bazaarpay/StartBazaarPay.kt
+++ b/BazaarPay/src/main/java/ir/cafebazaar/bazaarpay/StartBazaarPay.kt
@@ -5,7 +5,6 @@ import android.content.Context
import android.content.Intent
import androidx.activity.result.contract.ActivityResultContract
import ir.cafebazaar.bazaarpay.arg.BazaarPayActivityArgs
-import kotlinx.coroutines.flow.flow
/**
* An [ActivityResultContract] to start a payment.
diff --git a/README.md b/README.md
index f2a19570..ffe227e9 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,18 @@
## BazaarPay Android SDK
-This document aims to help you to integrate the *BazaarPay* android SDK within your application. For
-the topics out of this scope, read the corresponding documents.
+
+
+[](https://jitpack.io/#cafebazaar/bazaarpay)
+[](https://www.apache.org/licenses/LICENSE-2.0)
+
+BazaarPay is an all-in-one digital payment service that provides innovative payment solutions,
+including [Direct debit](https://en.wikipedia.org/wiki/Direct_debit)
+, [E-wallet](https://en.wikipedia.org/wiki/Digital_wallet),
+and [BNPL](https://en.wikipedia.org/wiki/Buy_now,_pay_later). Our goal is to simplify money
+management and help businesses increase sales.
+
+This project is the SDK for integrating BazaarPay within your Android applications. For additional
+information about BazaarPay, please visit our [website](https://bazaarpay.ir/).
### Requirements
@@ -11,8 +22,24 @@ the topics out of this scope, read the corresponding documents.
## Setup
-`BazaarPay` is available through the JitPack repository. You can declare this repository in your
-project `build.gradle` file:
+### Configure the repositories
+
+`BazaarPay` is available through the *JitPack* repository. You can declare this repository in your
+build script as follows:
+
+
+Kotlin DSL
+
+```kotlin
+repositories {
+ maven { url = uri("https://jitpack.io") }
+}
+```
+
+
+
+
+Groovy DSL
```groovy
repositories {
@@ -20,19 +47,40 @@ repositories {
}
```
-Add the dependency to your module `build.gradle` file:
+
+
+### Add the dependency
+
+After repository configuration, add a dependency on BazaarPay to your module's `build.gradle`
+file:
+
+
+Kotlin DSL
+
+```kotlin
+dependencies {
+ implementation("com.github.cafebazaar:bazaarpay:4.0.0")
+}
+```
+
+
+
+
+Groovy DSL
```groovy
dependencies {
- implementation 'com.github.cafebazaar:bazaarpay:[latest_version]'
+ implementation 'com.github.cafebazaar:bazaarpay:4.0.0'
}
```
+
+
## Usage
### 1. Register Payment Callback
-*BazaarPay* uses
+BazaarPay uses
the [Activity Result API](https://developer.android.com/training/basics/intents/result). Register
the payment callback by calling the `registerForActivityResult` with an instance
of `StartBazaarPay` as its `contract` parameter. The callback provides you with a boolean that
@@ -66,10 +114,8 @@ bazaarPayLauncher.launch(options)
you [generated before](#requirements). But there are also other optional parameters that you can
configure to your needs:
-* `phoneNumber` - the default phone number to pre-fill the login screen's input field. It uses a
- null value by default, resulting in no pre-filled input.
-* `isInDarkMode` - enables Dark Mode for the UI elements of the payment flow, which are in Light Mode
- by default.
+* `phoneNumber` - pre-fills the input field of the login screen with this number.
+* `isInDarkMode` - enables Dark Mode for the UI elements of the payment flow.
### 3. Commit Checkout Token
@@ -77,7 +123,7 @@ You have to commit the *Checkout Token* after successful payment. There is a sus
function for this purpose that you can call from a coroutine scope:
```kotlin
-// Inside onSuccess callback of launchBazaarPay
+// Inside isSuccessful branch of the registered payment callback
myScope.launch {
commit(
checkoutToken = "CHECKOUT_TOKEN",
@@ -93,4 +139,21 @@ call it from a [WorkManager](https://developer.android.com/topic/libraries/archi
worker or a Service for safety reasons.
> Although sending tokens through the SDK is possible, we recommend this happens on the server
-> side.
+> side.
+
+License
+--------
+
+ Copyright 2022 Cafebazaar, Inc.
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.