Last updated:
0 purchases
lightspeedpay
LightSpeedPay Flutter SDK #
Overview #
LightSpeedPay Flutter SDK allows you to easily integrate payment functionalities into your Flutter applications. With this SDK, you can initiate transactions seamlessly using the LightSpeedPay class.
Installation #
To use the LightSpeedPay SDK in your Flutter project, follow these steps:
Add the following dependency to your pubspec.yaml file:
dependencies:
lightspeedpay_flutter_sdk: ^1.0.0
copied to clipboard
Run the following command to install the dependency:
flutter pub get
copied to clipboard
Usage #
Initiating a Transaction #
To initiate a transaction, use the initiateTransaction function of the LightSpeedPay class. Below is the function signature:
Future<void> initiateTransaction(
String amount,
String method,
String description,
String billId,
String customerName,
String vpaId,
String apiKey,
String apiSecret,
)
copied to clipboard
amount: The amount of the transaction.
method: The payment method (only "unknown" is accepted).
description: Description of the transaction.
billId: Unique identifier for the bill.
customerName: Name of the customer.
vpaId: VPA ID (only compulsory when method is "collect").
apiKey: Your API key.
apiSecret: Your API secret.
Example #
import 'package:flutter/material.dart';
import 'package:lightspeedpay_flutter_sdk/lightspeedpay_flutter_sdk.dart';
class MyTransactionScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Initiate Transaction'),
),
body: Center(
child: ElevatedButton(
onPressed: () async {
try {
await LightSpeedPay().initiateTransaction(
"100.00",
"unknown",
"Sample transaction",
"123456",
"John Doe",
"john.doe@upi", // Example VPA ID, replace with actual one if needed
"YOUR_API_KEY",
"YOUR_API_SECRET",
);
print('Transaction initiated successfully');
} catch (e) {
print('Error initiating transaction: $e');
}
},
child: Text('Initiate Transaction'),
),
),
);
}
}
copied to clipboard
Replace "YOUR_API_KEY" and "YOUR_API_SECRET" with your actual API credentials from LightSpeedPay Dashboard.
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.