requestGooglePayToken method
Future<Map<String, dynamic> ?>
requestGooglePayToken({
- required String gateway,
- required String gatewayMerchantId,
- required String merchantName,
- required String environment,
- required String amount,
- required String currencyCode,
- required String countryCode,
- required List<
String> supportedNetworks, - required List<
String> allowedAuthMethods,
override
Presents the native Google Pay sheet and, once the payer confirms,
returns a map shaped {"paymentToken": {...}, "billingContact": {...}}:
paymentTokenis the full Google PayPaymentDataJSON object, which is exactly what Mobibox expects in the S2S CARD SALEpayment_tokenfield fordigital_wallet=googlepay.billingContactuses the same keys as the Apple Pay flow (givenName/familyName/address/city/state/zip/countryCode/phoneNumber/emailAddress), sourced from the FULL-format billing address + email the sheet collects.
Returns null if the payer dismisses the sheet.
Implementation
@override
Future<Map<String, dynamic>?> requestGooglePayToken({
required String gateway,
required String gatewayMerchantId,
required String merchantName,
required String environment,
required String amount,
required String currencyCode,
required String countryCode,
required List<String> supportedNetworks,
required List<String> allowedAuthMethods,
}) async {
final result = await methodChannel
.invokeMapMethod<String, dynamic>('requestGooglePayToken', {
'gateway': gateway,
'gatewayMerchantId': gatewayMerchantId,
'merchantName': merchantName,
'environment': environment,
'amount': amount,
'currencyCode': currencyCode,
'countryCode': countryCode,
'supportedNetworks': supportedNetworks,
'allowedAuthMethods': allowedAuthMethods,
});
if (result == null) {
// Payer dismissed the Google Pay sheet.
return null;
}
return Map<String, dynamic>.from(result);
}