shurjopay_sdk 0.0.2
shurjopay_sdk: ^0.0.2 copied to clipboard
Flutter shurjoPay SDK.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:shurjopay_sdk/shurjopay_sdk.dart';
void main() {
runApp(const MaterialApp(home: MyApp()));
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
MyAppState createState() => MyAppState();
}
class MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: AppBar(
title: const Text("shurjoPay SDK - shurjoMukhi Ltd"),
),
body: Center(
child: ElevatedButton(
child: const Text('Launch screen'),
onPressed: () {
onShurjopaySdk(context);
},
),
),
),
);
}
void onShurjopaySdk(BuildContext context) {
// 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",
);
// 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.
},
);
// TODO payment request setup
shurjopaySdk.makePayment(
context: context,
sdkType: AppConstants.SDK_TYPE_SANDBOX,
data: requiredRequestData,
);
}
}