Flutter shurjoPay SDK v2
Using
Add dependencies: shurjopay_sdk
dependencies:
connectivity_plus: ^2.1.0
http: ^0.13.4
webview_flutter: ^3.0.0
shurjopay_sdk: ^0.0.5
Import package:
import "package:shurjopay_sdk/shurjopay_sdk.dart";
Android build.gradle
defaultConfig {
minSdkVersion 20
}
Android AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
Request Data Model Setup:
// TODO request data model setup
RequiredRequestData requiredRequestData = RequiredRequestData(
username: "username",
password: "password",
prefix: "prefix",
currency: "currency",
amount: 1,
orderId: "order_id",
discountAmount: "discount_amount",
discPercent: 0,
customerName: "customer_name",
customerPhone: "customer_phone",
customerEmail: "customer_email",
customerAddress: "customer_address",
customerCity: "customer_city",
customerState: "customer_state",
customerPostcode: "customer_postcode",
customerCountry: "customer_country",
returnUrl: "return_url",
cancelUrl: "cancel_url",
clientIp: "client_ip",
value1: "value1",
value2: "value2",
value3: "value3",
value4: "value4",
);
Response Listener Setup:
// TODO request response listener setup
ShurjopaySdk shurjopaySdk = ShurjopaySdk(
onSuccess: (BuildContext context, TransactionInfo transactionInfo) {
// TODO you get success response, if the transection is succefully completed.
},
onFailed: (BuildContext context, String message) {
// TODO you get failed response, if the transection is failed or canceled.
},
onInternetFailed: (BuildContext context, String message) {
// TODO you get internet failed message, if the internet is not connected or on internet.
},
);
Payment Request Setup:
// TODO payment request setup
shurjopaySdk.makePayment(
context: context,
sdkType: "sdk_type", //TODO live/sandbox request
data: requiredRequestData,
);
Payment Success Respons:
onSuccess: (BuildContext context, TransactionInfo transactionInfo) {
// TODO you get success response, if the transection is succefully completed.
int? id = transactionInfo.id;
String orderId = transactionInfo.orderId;
String? currency = transactionInfo.currency;
double? amount = transactionInfo.amount;
double? payableAmount = transactionInfo.payableAmount;
double? discsountAmount = transactionInfo.discsountAmount;
double? discPercent = transactionInfo.discPercent;
double? usdAmt = transactionInfo.usdAmt;
double? usdRate = transactionInfo.usdRate;
String? cardHolderName = transactionInfo.cardHolderName;
String? cardNumber = transactionInfo.cardNumber;
String? phoneNo = transactionInfo.phoneNo;
String? bankTrxId = transactionInfo.bankTrxId;
String? invoiceNo = transactionInfo.invoiceNo;
String? bankStatus = transactionInfo.bankStatus;
String? customerOrderId = transactionInfo.customerOrderId;
int? spCode = transactionInfo.spCode;
String? spMassage = transactionInfo.spMassage;
String? name = transactionInfo.name;
String? email = transactionInfo.email;
String? address = transactionInfo.address;
String? city = transactionInfo.city;
String? transactionStatus = transactionInfo.transactionStatus;
String? dateTime = transactionInfo.dateTime;
String? method = transactionInfo.method;
String? value1 = transactionInfo.value1;
String? value2 = transactionInfo.value2;
String? value3 = transactionInfo.value3;
String? value4 = transactionInfo.value4;
}
Flutter shurjoPay SDK v2