Payfa is a quick and easy library for projects that require a payment gateway.
Payfa supports Google Chrome and the internal browser, you can change the color of the payment page to use the built-in browser. It is better to use Google Chrome to publish in markets that do not accept the internal browser. If you want to use the internal browser, you can explain to your market support.
- Fast
- Easy
- High Security
- Android X
minSdkVersion 14
You can download a jar from GitHub's releases page.
Or use Gradle:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.skhanbeiki:Payfa:1.3'
}
Or Maven:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.skhanbeiki</groupId>
<artifactId>Payfa</artifactId>
<version>1.0</version>
</dependency>
Request :
new Payfa().init(API, Activity.this)
.amount(1100, Currency.toman)
.invoice(new Random().nextInt(1256325))
.listener(Activity.this) // implements PayfaRequest
.internalBrowser(false) //if true .toolbarColor("#00ffff")
.requestCode(1371)
.nameAndDetails("name", "details")
.build();
@Override
public void onLaunch() {
Log.i("TextProject", "onLaunch");
}
@Override
public void onFailure(ErrorModel errorModel) {
Log.i("TextProject", errorModel.msg + " " + errorModel.code);
}
@Override
public void onFinish(String paymentId) {
Log.i("TextProject", "onFinish = " + paymentId);
}
Status :
new Payfa().payStatus(API, getApplicationContext(), Activity.this); // implements PayfaVerify
@Override
public void onFailure(ErrorModel errorModel) {
}
@Override
public void onFinish(Status status) {
}
Or :
new Payfa().payStatus(API, "payment_id", Activity.this); // implements PayfaVerify
@Override
public void onFailure(ErrorModel errorModel) {
}
@Override
public void onFinish(Status status) {
}
manifest :
To return from the Bank page to the desired activity
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="@string/host1"
android:scheme="http" />
</intent-filter>
String File :
<string name="host1">payfa.com</string>
implementation 'org.jetbrains:annotations:16.0.1'
implementation 'androidx.browser:browser:1.2.0'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
This is not an official Google product.