Start Transaction
- Java
- Kotlin
- React Native
- Flutter
Your Android App
// 3rd parameter is for setting a primary colour to theme the BharatX SDK
// you can remove it to use BharatX's default colour value
BharatXTransactionManager.initialize(
this, "testSimplePartnerId", "testSimpleApiKey", Color.parseColor("#000000"));
BharatXTransactionManager.startTransaction(
this,
transactionId, // optional - pass null if you don't want this param
userId, // optional - pass null if you don't want this param
phoneNumber,
amountInPaise,
// optional - you can remove this param
new BharatXTransactionManager.TransactionListener() {
@Override
void onSuccess() {
// on success
}
@Override
void onFailure() {
// on failure - optional, you can remove this
}
@Override
void onCancelled() {
// on cancelled - optional, you can remove this
}
});
Your Android App
// 3rd parameter is for setting a primary colour to theme the BharatX SDK
// you can remove it to use BharatX's default colour value
BharatXTransactionManager.initialize(
this, "testSimplePartnerId", "testSimpleApiKey", Color.parseColor("#000000"))
BharatXTransactionManager.startTransaction(
this,
transactionId, // optional - pass null if you don't want this param
userId, // optional - pass null if you don't want this param
phoneNumber,
amountInPaise,
// optional - you can remove this param
object : BharatXTransactionManager.TransactionListener() {
override fun onSuccess() {
// on success
}
override fun onFailure() {
// on failure - optional, you can remove this
}
override fun onCancelled() {
// on cancelled - optional, you can remove this
}
})
React Native App
import BharatXSecurityHelpers from '@bharatx/bharatx-reactnative-securityhelpers';
import BharatXTransactionManager from '@bharatx/bharatx-reactnative-simple';
// ...
(async () => {
await BharatXTransactionManager.initialize(
'testSimplePartnerId',
'testSimpleApiKey'
);
// for Theme Color - you can skip if you want the default color
// in hex
BharatXSecurityHelpers.storeThemeColorPreferenceInHex("#FFFFFF");
// in rgba
BharatXSecurityHelpers.storeThemeColorPreferenceInRGBA("rgba(255, 255, 255, 1)");
BharatXTransactionManager.startTransaction(
transactionId, // optional - pass null if you don't want this param
userId, // optional - pass null if you don't want this param
phoneNumber,
amountInPaise,
// remnant of a deprecated feature. pass null.
null,
// optional - pass null if you don't want this param
(event) => {
if(event === "onSuccess") {
} else if(event == "onCancelled") {
} else if(event == "onFailure") {
}
}
);
})();
Flutter App
import 'package:bharatx_flutter_simple/bharatx_flutter_simple.dart';
// ...
// 3rd parameter is for setting a primary colour to theme the BharatX SDK
// you can remove it to use BharatX's default colour value
await BharatXTransactionManager.initialize(
"testSimplePartnerId", "testSimpleApiKey", Colors.deepOrange);
// or with a hex int
await BharatXTransactionManager.initialize(
"testSimplePartnerId", "testSimpleApiKey", 0xFF5722);
// or with a hex string (the '#' is optional)
await BharatXTransactionManager.initialize(
"testSimplePartnerId", "testSimpleApiKey", "#FF5722");
// all named parameters are optional
BharatXTransactionManager.startTransaction(phoneNumber, amountInPaise,
transactionId: transactionId,
userId: userId,
onSuccess: () {
}, onCancelled: () {
}, onFailure: () {
}
);