This plugin is to give an idea of what ApplePay will probably look like. Thanks to Max Mamis for this blog post.
cordova plugin add https://github.com/jbeuckm/cordova-plugin-applepay.git
- iOS
- ApplePay.setMerchantId
- ApplePay.makePaymentRequest
Set your Apple-given merchant ID.
ApplePay.setMerchantId("merchant.my.id");
Request a payment with Apple Pay.
ApplePay.makePaymentRequest(successCallback, errorCallback, order);
- order.items: Array of item objects with form
{ label: "Item 1", amount: 1.11 }
- order.shippingMethods: Array of item objects with form
{ identifier: "My Method", detail: "Ship by method 1", amount: 1.11 }
ApplePay.setMerchantId("merchant.apple.test");
function onError(err) {
alert(JSON.stringify(err));
}
function onSuccess(response) {
alert(response);
}
ApplePay.makePaymentRequest(onSuccess, onError, {
items: [
{ label: "item 1", amount: 1.11 },
{ label: "item 2", amount: 2.22 }
],
shippingMethods: [
{ identifier: "By Sea", detail: "Shipmates on a ship.", amount: 1.11 },
{ identifier: "Airmail", detail: "Ship it by airplane.", amount: 5.55 }
]
);