To test the ApplePayButton
widget, I tried creating a new sample Flutter project using flutter create .
And in the Hello world screen, I added one thing only which is ApplePayButton
widget from pay
dependency because my original project was returning a weird error which is platformexception(paymenterror, failed to present payment controller, null, null)
from the onError
property, but I ended up getting the same error in the new hello world project so there is hardly any context. Here is the widget I used and the configuration:
ApplePayButton(
onPaymentResult: (result) => greenToast(result.toString()),
paymentItems: [
PaymentItem(
amount: "111.01",
label: "test",
),
],
onError: (error) => redToast(error.toString()),
paymentConfiguration: PaymentConfiguration.fromJsonString('''
{
"provider": "apple_pay",
"data": {
"merchantIdentifier": "merchant.xxx.xxx",
"displayName": "app_name",
"merchantCapabilities": ["3DS", "debit", "credit"],
"supportedNetworks": ["amex", "visa", "mada", "masterCard"],
"countryCode": "SA",
"currencyCode": "SAR"
}
}
'''),
),
Some notes about my setup and things I tried:
flutter ios --release --no-tree-shake-icons
flutter ios --release
Apple Pay Payment Processing Certificate
PlatformException
from Flutter didn't return any more information as far as I know except: platformexception(paymenterror, failed to present payment controller, null, null)