create method
Future<PaymentBridgeSuccess>
create({
- double amount = 0,
- String name = '',
- String description = '',
- String mobile = '',
- String email = '',
override
Implementation
@override
Future<PaymentBridgeSuccess> create({
double amount = 0,
String name = '',
String description = '',
String mobile = '',
String email = '',
}) {
options['amount'] = amount * 100;
options['name'] = name;
options['description'] = description;
options['prefill']['contact'] = mobile;
options['prefill']['email'] = email;
if (isAndroid || isIOS) {
var _razorpay = Razorpay();
_razorpay.on(Razorpay.EVENT_PAYMENT_SUCCESS,
(PaymentSuccessResponse response) {
PaymentBridgeSuccess(
id: response.paymentId,
orderId: response.orderId,
signature: response.signature,
);
});
_razorpay.on(Razorpay.EVENT_PAYMENT_ERROR,
(PaymentFailureResponse response) {
PaymentBridgeError(
code: response.code,
message: response.message,
);
});
_razorpay.on(Razorpay.EVENT_EXTERNAL_WALLET,
(ExternalWalletResponse response) {
// Do something when an external wallet was selected
});
_razorpay.open(options);
}
if (isWeb) {
var razorpay = payment.Razorpay();
razorpay.open(options);
}
return Future.value(PaymentBridgeSuccess(amount: 0));
}