Skip to content

cevatkerim/cordova-plugin-applepay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

org.beuckman.applepay

This plugin is to give an idea of what ApplePay will probably look like. Thanks to Max Mamis for this blog post.

Installation

cordova plugin add https://github.com/jbeuckm/cordova-plugin-applepay.git

Supported Platforms

  • iOS

Methods

  • ApplePay.setMerchantId
  • ApplePay.makePaymentRequest

ApplePay.setMerchantId

Set your Apple-given merchant ID.

ApplePay.setMerchantId("merchant.my.id");

ApplePay.makePaymentRequest

Request a payment with Apple Pay.

ApplePay.makePaymentRequest(successCallback, errorCallback, order);

Parameters

  • 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 }

Example

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 }
    ]
);

About

Implement the ApplePay request.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published