Hey everybody!
I tried implementing the Apple Pay Plugin but stuck at the following error when calling makePaymentRequest():
PKPaymentAuthorizationViewController was nil
My code:
async payWithApplePay() {
await this.applePay.canMakePayments()
.then(blCanMakePayments => {
if(blCanMakePayments) {
try {
let Articles = [];
this.basketStorage.forEach((Article: any) => {
Articles.push({
label: Article.title,
amount: Article.price,
});
});
let order: any = {
items: Articles,
shippingMethods: [
{
identifier: 'Standard',
label: 'Kostenlose Lieferung',
detail: 'Wir liefern Dir das Essen an die Tür',
amount: 0,
}
],
merchantIdentifier: '...',
currencyCode: 'EUR',
countryCode: 'DE',
billingAddressRequirement: ['name', 'email', 'phone'],
shippingAddressRequirement: ['name', 'email', 'phone'],
shippingType: 'delivery',
supportedNetworks: ['visa', 'masterCard', 'discover', 'amex'],
merchantCapabilities: ['3ds', 'debit', 'credit'],
};
this.applePay.makePaymentRequest(order)
.then((paymentResponse: any) => {
console.log('paymentResponse', paymentResponse);
this.applePay.completeLastTransaction('success');
})
.catch(error => { ... });
} catch(error => { ... });
}
})
.catch(error => { ... });
}
This is what i did:
- cordova plugin add cordova-plugin-applepay
- npm i --save @ionic-native/apple-pay
- Added com.apple.developer.in-app-payments for Debug and Release to config.xml
- Configured the merchant certificate at Apple Developer Acocunt.
I tried both, on emulator and real device, in TestFlight and after the app has been release.
I also tried removing the platform / plugin and re-adding it.
Any ideas?
Thank you so much!