switchpay 0.0.5 switchpay: ^0.0.5 copied to clipboard
A Flutter plugin that provides Switchpay.
Switchpay is an intelligent system of routing payment traffic via various payment aggregrators (PA).
Configuration #
iOS #
Add below keys in info.plist using Xcode
. The steps that has to be followed are:
- Open your project target's
info.plist
file. - Add a Key called
NSAppTransportSecurity
as a Dictionary. - Add a Subkey called
NSAllowsArbitraryLoads
asBoolean
and set its value toYES
.
or
In source code of info.plist
file we can add that:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Android #
Add the below line in your application
tag of AndroidManifest.xml
:
android:usesCleartextTraffic="true"
As shown below:
<application
....
android:usesCleartextTraffic="true"
....>
Usage #
To use this plugin, add switchpay
as a dependency in your pubspec.yaml file.
The switchpay
package can be imported using:
import 'package:switchpay/switchpay.dart';
Example #
Switchpay(
context: context,
url: 'your_context',
token: 'your_token',
uuid: 'your_uuid',
orderId: 'your_unique_order_id',
amount: 'transactional_amount',
name: 'customer_name',
emailId: 'customer_email',
mobileNumber: 'customer_mobile_number',
description: 'description_for_record',
enabledModeOfPayment: 'instrument like upi or cc',
onInitLoading: (isLoading) {
// TODO: Show loading action while redirecting.
},
onTransactionCompleted: (status) {
// TODO: Action after transaction completion. (Deprecated)
},
onTransactionDone: (status) {
// TODO: Action after transaction completion. (Deprecated)
},
onTransactionFinished: (status) {
// TODO: Action after transaction completion. (Recommended)
},
onErrorOccurred: (error) {
// TODO: Action if any error occured.
});