in code The method 'startPayment' isn't defined for the type 'PayUCheckoutProFlutter'. Try correcting the name to the name of an existing method, or defining a method named 'startPayment'.
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'dart:convert';
import 'package:payu_checkoutpro_flutter/payu_checkoutpro_flutter.dart';
class MyClass extends StatefulWidget {
@override
_MyClassState createState() => _MyClassState();
}
class _MyClassState extends State<MyClass> implements PayUCheckoutProProtocol {
late PayUCheckoutProFlutter _checkoutPro;
@override
void initState() {
super.initState();
_checkoutPro = PayUCheckoutProFlutter(this);
}
this method i use
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('PayU Checkout Pro'),
),
body: Center(
child: ElevatedButton(
child: Text("Make Payment"),
onPressed: () async {
String orderId = DateTime.now().millisecondsSinceEpoch.toString();
String amount = "1";
var response = await _checkoutPro.startPayment( // here show this error in startPaymnet
orderId: orderId,
amount: amount,
productInfo: 'iPhone 12',
merchantKey: 'your_merchant_key',
userPhoneNumber: '9999999999',
transactionId: orderId,
firstName: 'Orange',
merchantSalt: 'your_merchant_salt',
email: '[email protected]',
hashUrl: '',
userCredentials: '',
);
// Handle the response
if (response['status'] == 'success') {
handlePaymentSuccess(amount);
} else if (response['status'] == 'failed') {
handlePaymentFailure(amount, response['message']);
}
},
),
),
);
}
@override
generateHash(Map response) {
// Implement the logic to generate the hash using the response received from your backend server
// Pass the generated hash to the SDK using _checkoutPro.hashGenerated(hash: hashResponse);
// Example:
Map<String, String> hashResponse = {
'hashName': 'paymentHash',
'hash': 'your_generated_hash_here',
};
_checkoutPro.hashGenerated(hash: hashResponse);
}
@override
onPaymentSuccess(dynamic response) {
// Handle the payment success response
}
@override
onPaymentFailure(dynamic response) {
// Handle the payment failure response
}
@override
onPaymentCancel(Map? response) {
// Handle the payment cancel response
}
@override
onError(Map? response) {
// Handle the error response
}
void handlePaymentSuccess(String amount) {
// Handle payment success logic
}
void handlePaymentFailure(String amount, String message) {
// Handle payment failure logic
}
how to slove this error whats a method for startPayment for call payment function. payu_checkoutpro_flutter depedancy use is right for payu payment gateway?