requestGooglePayToken method

  1. @override
Future<Map<String, dynamic>?> requestGooglePayToken({
  1. required String gateway,
  2. required String gatewayMerchantId,
  3. required String merchantName,
  4. required String environment,
  5. required String amount,
  6. required String currencyCode,
  7. required String countryCode,
  8. required List<String> supportedNetworks,
  9. required List<String> allowedAuthMethods,
})
override

Presents the native Google Pay sheet and, once the payer confirms, returns a map shaped {"paymentToken": {...}, "billingContact": {...}}:

  • paymentToken is the full Google Pay PaymentData JSON object, which is exactly what Mobibox expects in the S2S CARD SALE payment_token field for digital_wallet=googlepay.
  • billingContact uses 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);
}