Page History
...
To work with Assist.Mobile, you need to use Android SDK version 15 26or higher (Android 4 8.0 .3Oreo).
Description of SDK Assist.Mobile
...
useCamera - a flag indicating to use the mobile device's camera to read the customer's bank card number or enter the number manually.
After the successful completion of the payment, you can save the buyer's signature using the method:
void assistPayEngine.setUserSignature(long id, byte[] signature),
where
id - payment transaction ID.
Additionally, you can check the result of the payment using the method:
...
Note |
---|
The string is generated from order parameters with semicolon as delimiter. The following parameters are included in the string: Merchant _ ID;OrderNumber;OrderAmount;OrderCurrency. Then the MD5 hash prepared from this string. Hash is signed by private RSA key of the merchant. Key length - 1024. Received bit byte sequence is a signature of the merchant. Signature is transferred as an additional parameter encoded as a string in BASE64 format. |
Storage of payment results
The payments made are stored in SQLite DB, which is accessed through the AssistTransactionStorage interface and the AssistTransactionFilter and AssistTransactionsLoader classes.
...
An instance of the AssistTransactionsLoader class must be created in the onCreateLoader(int id, Bundle args) method of the class that implements the LoaderManager.LoaderCallbacks<> interface.
...
Google Pay support
To work with Android Google Pay, it is recommended that you first read the documentation on the developer's website https://developers.google.com/android-pay/.
At the moment, work with the Google wallet is presented in the SANDBOX mode. Therefore, to determine the possibility of making a test payment, you need to contact the Assist support service support@assist.ru.
...
- Copy the mobilePay-release-X.X.X.aar file to the /libs directory of the app module.
Add to module's build.gradle.
Code Block language actionscript3 repositories { flatDir { dirs 'libs' } } dependencies { compile 'io.card:android-sdk:5.0.0' compile(name: 'mobilePay-release-X.X.X', ext: 'aar') }
- Make following changes in AndroidManifect.xml:
3.1. First you need to make sure that the minimum SDK version is
...
26 or higher. There should be an
...
tag like this inside the <manifest>
...
tag:
Code Block | ||
---|---|---|
| ||
<uses-sdk android:minSdkVersion="26"/> |
3.2. The following permissions must also be present inside the <manifest
...
> tag:
Code Block | ||
---|---|---|
| ||
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-feature android:name="android.hardware.camera" android:required="false" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.camera.flash" android:required="false" /> |
3.3. Add an activity to the <application
...
> tag:
Code Block | ||
---|---|---|
| ||
<activity
android:name="ru.assisttech.sdk.processor.WebViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize">
</activity>
<activity
android:name="io.card.payment.CardIOActivity"
android:configChanges="keyboardHidden|orientation" />
<activity android:name="io.card.payment.DataEntryActivity" /> |
3.4. Before releasing the app, you need to add to the proguard configuration file:
Code Block | ||
---|---|---|
| ||
```
-keep class io.card.**
-keepclassmembers class io.card.** {
*;
}
-keep class ru.assisttech.sdk.**
-keepclassmembers class ru.assisttech.sdk.** {
*;
}
``` |
An example of payment implementing using the Assist.Mobile SDK
Code Block | ||
---|---|---|
| ||
package ru.assisttech.example;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import ru.assisttech.sdk.AssistSDK;
import ru.assisttech.sdk.AssistPaymentData;
import ru.assisttech.sdk.engine.AssistPayEngine;
import ru.assisttech.sdk.engine.PayEngineListener;
import ru.assisttech.sdk.storage.AssistTransaction;
public class
MainActivity extends
Activity implements
PayEngineListener {
private TextView tvPaymentResult;
private AssistPayEngine
engine;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tvPaymentResult = (TextView) findViewById(R.id.textView);
// Getting a payment component from the library
engine= AssistSDK.getPayEngine(this);
// Setting the server address
engine.setServerURL("server url");
// Setting the listener of the result
engine.setEngineListener(this);
findViewById(R.id.btPay).setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
// Setting payment options
AssistPaymentData data = new AssistPaymentData();
// Merchant ID in IPS Assist
data.setMerchantId("12345");
// Order number
data.setOrderNumber("OrderNo");
// Amount
data.setOrderAmount("100"); // 100 RUB
// Currency
data.setOrderCurrency(AssistPaymentData.Currency.RUB);
// Comment
data.setOrderComment("Test payment");
// Payer's e-mail
data.setEmail("customer@mail.com");
// Payer's postal address
data.setAddress("Москва, Ленинградское ш. 39");
// Home phone
data.setHomePhone("567-99-29");
// Work phone
data.setWorkPhone("555-00-00");
// Mobile phone
data.setMobilePhone("+79067410863");
// Fax
data.setFax("");
// Lastname
data.setLastname("Романов");
// First name
data.setFirstname("Пётр");
// Middle name
data.setMiddlename("Алексеевич");
// Payer country
data.setCountry("Russia");
// Region (state)
data.setState("Moscow");
// City
data.setCity("Moscow");
// Postal code
data.setZip("100290");
// Language
data.setLanguage(AssistPaymentData.Lang.RU);
// Payment parameters signature calculation...
String signature = "stub_signature";
// Signature setting
data.setSignature(signature);
// Starting the payment process
engine.payWeb(MainActivity.this, data, false);
}
});
}
/**
* PayEngineListener callbacks
*/
@Override
public void onFinished(Activity activity, AssistTransaction assistTransaction) {
if (!this.equals(activity)) {
activity.finish();
}
tvPaymentResult.setText(assistTransaction.getResult().getOrderState().toText());
}
@Override
public void onCanceled(Activity activity, AssistTransaction assistTransaction) {
if (!this.equals(activity)) {
activity.finish();
}
tvPaymentResult.setText(assistTransaction.getResult().getOrderState().toText());
}
@Override
public void onFailure(Activity activity, String info) {
tvPaymentResult.setText("Error: " + info);
}
@Override
public void onNetworkError(Activity activity, String s) {
tvPaymentResult.setText("Network error: " + s);
}
} |
The SDK and the sample app are available for download at the following link:
https://github.com/assist-group/assist-mcommerce-sdk-android