Hi,
I am new and i want to integrate applePay in one of the website, can you please guide me how can i start and from where i can get all the skds and code?
Hi,
I am new and i want to integrate applePay in one of the website, can you please guide me how can i start and from where i can get all the skds and code?
I've been having a go at this too. You can get the applepay sheet displayed just by following the notes in the WWDC video #703 https://developer.apple.com/videos/play/wwdc2016/703/
But I've not found any documentation regarding the merchant authentication call (i.e. the call which uses the validationURL ) or steps after that.
To get it working this far just paste this into a https:// accessible page on your domain
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-gb" xml:lang="en-gb"><head>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>
<script type="text/javascript">
$( document ).ready( function( )
{
if (window.ApplePaySession) {
var merchantIdentifier = 'merchant.com.yourcompanydomain';
var promise = ApplePaySession.canMakePaymentsWithActiveCard(merchantIdentifier);
promise.then(function (canMakePayments) {
if (canMakePayments)
console.log('hi, I can do ApplePay');
$("#applePay").show();
});
} else {
console.log('ApplePay not available on this browser');
$("#applePay").after('ApplePay not available on this browser');
}
$("#applePay").click( function(evt) {
var paymentRequest = {
currencyCode: 'GBP',
countryCode: 'GB',
total: {
label: 'Canine Clothing',
amount: '19.99'
},
supportedNetworks: ['amex', 'discover', 'masterCard', 'visa' ],
merchantCapabilities: [ 'supports3DS' ],
requiredShippingAddressFields: [ 'postalAddress' ]
};
var session = new ApplePaySession(1, paymentRequest);
// Merchant Validation
session.onvalidatemerchant = function (event) {
var promise = performValidation(event.validationURL);
promise.then(function (merchantSession) {
session.completeMerchantValidation(merchantSession);
}); }
session.begin();
});
});
</script>
<style>
#applePay {
width: 150px;
height: 50px;
display: inline-block;
border: 1px solid black;
border-radius: 5px;
box-sizing: border-box;
background-image: -webkit-named-image(apple-pay-logo-black);
background-size: 100% 100%;
background-repeat: no-repeat;
}
</style>
</head>
<body>
<button type="button" id="applePay" style="display:none"></button>
</body>
</html>
Hi, Your answer was really helpful!!! However I have one question. Before using this code to show the applepay buton on your site, what all are the steps that you did? I am also trying to do the same, but I am facing lot of challenges. Below are the steps that I have done: 1. Installed Beta versions of Sierra and iOS102. Got Apple Developer Account3. Created a Merchant ID4. While trying to Map domain names with merchant Id, developer.apple.com will ask for verify a URL similar to "https://somedomain.com/.well-known/apple-developer-merchantid-domain-association" - How did you proceed with this step in your local server?5. Generating certificate - Did you do this step and added this certificate to cacerts?6. For setting up Sanbox for adding test credit cards in to Wallet, did you create any user?I think, only after completing all the above steps, we can proceed to use the code in your post, right? Am I missing any step/s here? Your response would be much appreciated... Thanks
Hi Norfolk,
This reply is very helpful.
Can we have any sample demo sdk for Applepay web integration ?
Your answer was really helpful!!!
However I have one question. Before using this code to show the applepay buton on your site, what all are the steps that you did? I am also trying to do the same, but I am facing lot of challenges. Below are the steps that I have done:
1. Installed Beta versions of Sierra and iOS10
2. Got Apple Developer Account
3. Created a Merchant ID
4. While trying to Map domain names with merchant Id, developer.apple.com will ask for verify a URL similar to "https://somedomain.com/.well-known/apple-developer-merchantid-domain-association" - How did you proceed with this step in your local server?
5. Generating certificate - Did you do this step and added this certificate to cacerts?
6. For setting up Sanbox for adding test credit cards in to Wallet, did you create any user?
I think, only after completing all the above steps, we can proceed to use the code in your post, right? Am I missing any step/s here?
Your response would be much appreciated...
Thanks
Hi. I've put my working example on github here https://github.com/norfolkmustard/ApplePayJS
Does anyone have an answer for @Test76 4th question "How did you proceed with this step in your local server?", How can I verify my local server for Apple Pay on the web?
Any response would be appreciated
Hi
I am having similar issues.
I have generated certificate.
But no were there is adocumentation showing how to use this certificate in the develop environment locally or on windows server.
I have done all the previous process
Generated the certificate and installed it on the server.
But cannot get the request code to work
Below is the vb code I am using.
RequestBody="{merchantIdentifier: merchant.adyen.hoppa.test,domainName: www.hoppa.com, displayName: 'My Store',}"URL="https://apple-pay-gateway-cert.apple.com/paymentservices/startSession"
Set objHttp = Server.CreateObject("WinHTTP.WinHTTPRequest.5.1")
WinHttpRequestOption_SslErrorIgnoreFlags=4
objHttp.Option(WinHttpRequestOption_SslErrorIgnoreFlags) = &H3300
objHttp.Option(9) = 512
objHttp.setTimeouts 0, 120000, 120000, 120000
objHttp.open "POST", URL, False
objHttp.send RequestBody
when i run the code it says a valid certificate is required.
But I have installed the certificate on the servers.
Please advise or please provide technical contact where I can request for support