I want to use Google Pay in my app and I want to get my money in the Stripe dashboard.
I try the Flutter pay package, and now I am able to see the Google Pay sheet.
I am an Indian citizen, so I am not able to test Google Pay global in India, so how can I test my app? And I don't know how Google Pay responds when payment is a success.
Please attach some documentation or some example to integrate Google Pay with Stripe in Flutter.
I use this package: https://pub.dev/packages/pay
Here is my code for open Google Pay sheet:
import 'package:pay/pay.dart' as pay;
Widget _paymentOptions() {
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
pay.GooglePayButton(
paymentConfigurationAsset: PaymentJson.googlePay,
paymentItems: _paymentItems,
width: 300,
style: pay.GooglePayButtonStyle.black,
type: pay.GooglePayButtonType.pay,
margin: const EdgeInsets.only(top: 15.0),
onPaymentResult: (val) {
log(val.toString(), name: "Google Pay");
},
loadingIndicator: const Center(
child: CircularProgressIndicator(),
),
),
pay.ApplePayButton(
paymentConfigurationAsset: PaymentJson.applePay,
paymentItems: _paymentItems,
width: 300,
style: pay.ApplePayButtonStyle.black,
type: pay.ApplePayButtonType.buy,
margin: const EdgeInsets.only(top: 15.0),
onPaymentResult: (val) {
log(val.toString(), name: "Apple Pay");
},
childOnError: const Text(
"Apple pay Not Available Now",
style: TextStyle(
color: Colors.black, fontSize: 16, fontWeight: FontWeight.bold),
),
onError: (e) {
print(e);
showAppSnackBar("Google pay Not Available Now");
},
loadingIndicator: const Center(
child: CircularProgressIndicator(),
),
),
],
);
}
final _paymentItems = [
pay.PaymentItem(
label: 'Total',
amount: '99.99',
status: pay.PaymentItemStatus.final_price,
)
];