Skip to content
Permalink
Browse files

Merge branch 'master' of https://github.com/xcompanies/xBit-Android-SDK

  • Loading branch information...
MolarMak committed Mar 25, 2019
2 parents e14b9e6 + e493dff commit a216d466698493dc9a4450d5c49ad065532063d2
Showing with 182 additions and 0 deletions.
  1. +21 −0 LICENSE
  2. +161 −0 Readme.md
21 LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 xcompanies

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
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:

The above copyright notice and this permission notice shall be included in all
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,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
161 Readme.md
@@ -0,0 +1,161 @@
# xBit-Android-SDK

[![Platforms](https://img.shields.io/badge/platforms-android-lightgrey.svg)](https://jitpack.io/#xcompanies/xBit-Android-SDK/1.0.3)
[![License](https://img.shields.io/cocoapods/l/xBit_iOS_SDK.svg)](https://raw.githubusercontent.com/xcompanies/xBit-Android-SDK/master/LICENSE)
[![](https://jitpack.io/v/xcompanies/xBit-Android-SDK.svg)](https://jitpack.io/#xcompanies/xBit-Android-SDK)

xBit Android payments library

- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [License](#license)

## Requirements

- Android SDK 21+
- Android Studio 2.3.2+

## Installation

### Dependency Managers

[JitPack](https://jitpack.io/) is a novel package repository for JVM and Android projects. It builds Git projects on demand and provides you with ready-to-use artifacts

Add this lines to build.gradle (Project level):
``` gradle
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
```
Add this lines to build.gradle (App level):
``` gradle
dependencies {
implementation 'com.github.xcompanies:xBit-Android-SDK:1.0.3'
}
```

Or you can use this library together with:
<details>
<summary><strong>Maven</strong></summary>

``` maven
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
```

``` maven
<dependency>
<groupId>com.github.xcompanies</groupId>
<artifactId>xBit-Android-SDK</artifactId>
<version>1.0.3</version>
</dependency>
```

</details>

<details>
<summary><strong>Sbt</strong></summary>

``` sbt
resolvers += "jitpack" at "https://jitpack.io"
```

```sbt
libraryDependencies += "com.github.xcompanies" % "xBit-Android-SDK" % "1.0.3"
```
</details>

### Manually

<details>
<summary><strong>JAR file</strong></summary>

Add the compiled AAR (or JAR) file (the library must be already built):

- Click File > New > New Module.
- Click Import .JAR/.AAR Package then click Next.
- Enter the location of the compiled AAR or JAR file then click Finish.

</details>

<details>
<summary><strong>Source code</strong></summary>

Import the library module to your project (the library source becomes part of your project):

- Click File > New > Import Module.
- Enter the location of the library module directory then click Finish.

The library module is copied to your project, so you can actually edit the library code. If you want to maintain a single version of the library code, then this is probably not what you want and you should instead add the compiled AAR file as described above.
</details>

## Usage

To initiate a payment, you need to import library and call it's method this way to get Activity with payment View. After that you should present it:

<details>
<summary><strong>Java</strong></summary>

``` java
import com.xbitcrypto.sdk.PaymentFormCreator;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PaymentFormCreator.INSTANCE.runPaymentForm(
this,
"API KEY", //todo put your api key here
"API SECRET", //todo put your api secret here
1.0, // Amount of xBits to pay
"order ID", // Id of the order to pay for
"http://google.com"); // Url of the service that will handle your payment
}
}
```
</details>

<details>
<summary><strong>Kotlin</strong></summary>

``` kotlin
import com.xbitcrypto.sdk.PaymentFormCreator
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
PaymentFormCreator.runPaymentForm(
this,
"API KEY", //todo put your api key here
"API SECRET", //todo put your api secret here
1.0, // Amount of xBits to pay
"order ID", // Id of the order to pay for
"http://google.com") // Url of the service that will handle your payment
}
}
```
</details>

Example project is available at /app folder of the repository. To test it, clone repository and open it in Android Studio

## Contributing

Issues and pull requests are welcome!

## Author

Max Mamuta

## License

xBit_Android_SDK is released under the MIT license. See [LICENSE](https://raw.githubusercontent.com/xcompanies/xBit-Android-SDK/master/LICENSE) for details.

0 comments on commit a216d46

Please sign in to comment.
You can’t perform that action at this time.