requestApplePayNonce static method
Future
requestApplePayNonce({
- required String price,
- required String summaryLabel,
- required String countryCode,
- required String currencyCode,
- required ApplePayPaymentType paymentType,
- required ApplePayNonceRequestSuccessCallback onApplePayNonceRequestSuccess,
- required ApplePayNonceRequestFailureCallback onApplePayNonceRequestFailure,
- required ApplePayCompleteCallback onApplePayComplete,
Implementation
static Future requestApplePayNonce(
{required String price,
required String summaryLabel,
required String countryCode,
required String currencyCode,
required ApplePayPaymentType paymentType,
required ApplePayNonceRequestSuccessCallback
onApplePayNonceRequestSuccess,
required ApplePayNonceRequestFailureCallback
onApplePayNonceRequestFailure,
required ApplePayCompleteCallback onApplePayComplete}) async {
assert(summaryLabel.isNotEmpty, 'summaryLabel should not be empty.');
assert(price.isNotEmpty, 'price should not be empty.');
assert(countryCode.isNotEmpty, 'countryCode should not be empty.');
assert(currencyCode.isNotEmpty, 'currencyCode should not be empty.');
_applePayNonceRequestSuccessCallback = onApplePayNonceRequestSuccess;
_applePayNonceRequestFailureCallback = onApplePayNonceRequestFailure;
_applePayCompleteCallback = onApplePayComplete;
var paymentTypeString = _standardSerializers.serializeWith(
ApplePayPaymentType.serializer, paymentType);
try {
var params = <String, dynamic>{
'price': price,
'summaryLabel': summaryLabel,
'countryCode': countryCode,
'currencyCode': currencyCode,
'paymentType': paymentTypeString,
};
await _channel.invokeMethod('requestApplePayNonce', params);
} on PlatformException catch (ex) {
throw InAppPaymentsException(
ex.code,
ex.message,
ex.details[InAppPaymentsException.debugCodeKey],
ex.details[InAppPaymentsException.debugMessageKey]);
}
}