Apple Pay on the Web

RSS for tag

Apple Pay on the Web allows you to accept Apple Pay on your website using JavaScript-based APIs.

Posts under Apple Pay on the Web tag

109 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

Apple pay web authentication failed (SSL connection)
I have setup the server settings TLS, HTTPS I have performed the following steps but not working for me: 1. I have validated my domain 2. Generate Certificate Signing Request (CSR) using keychain. It created public and private key in MAC keychain 3. Uploaded CSR (from point 2) to apple Pay Merchant Identity Certificate. It gave me merchant_id.cer 4. Generated .p12 with merchant_id.cer, public and private key using keychain Now I am using this .p12 to create the ApplePaySession (paymentSession) using server side code in C# but getting error from apple side. Exception: The SSL connection could not be established Inner Exception: Authentication failed, The credentials supplied to the package were not recognized at System.Net.SSPIWrapper.AcquireCredentialsHandle Sample Code: var request = new MerchantSessionRequest() { DisplayName = "StoreName", Initiative = "web", InitiativeContext = "applepaypoc.xxxxxx.com", MerchantIdentifier = "merchant.com.xxxxxx.applepaypoc", }; string certPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot\\files", "NewP12.pfx"); X509Certificate2 certificate = new X509Certificate2(certPath, "xxxxx"); HttpClientHandler handler = new HttpClientHandler(); handler.ClientCertificates.Add(certificate); handler.SslProtocols = System.Security.Authentication.SslProtocols.Tls12; var resCode = string.Empty; using (HttpClient client = new HttpClient(handler)) { try { HttpResponseMessage response = await client.PostAsJsonAsync(request.ValidationURL, validationPayload); response.EnsureSuccessStatusCode(); resCode = response.StatusCode.ToString(); string responseBody = await response.Content.ReadAsStringAsync(); return responseBody; } catch (HttpRequestException e) { return $"resCode = {resCode} ///// Response Message: {e.Message} ///// Response Inner Exception: {e.InnerException.Message}"; } } **Ref: ** https://developer.apple.com/documentation/technotes/tn3103-apple-pay-on-the-web-troubleshooting-guide https://tech.justeattakeaway.com/2016/10/10/bringing-apple-pay-to-the-web/
2
0
185
2d
Payment Services Exception
调用 API 时,返回以下错误:Apple Pay 处理证书、Apple Pay 商家身份证书和商家域均已设置 { “statusMessage”: “支付服务异常 merchantId=1A9569E9792DB13B9BEE22EDB30515DE75D512B91A2C86C54D4065AD1ECC712E 未经授权代表 merchantId=4D08091EACD9C0D2E25CB94895D1B0DAE73970D6A517EF2988D6D929D1336DA1 reason=4D08091EACD9C0D2E25CB94895D1B0DAE73970D6A517EF2988D6D929D1336DA1 不是 WWDR 的注册商家,也没有通过 Mass Enabling 获得适当授权。 “状态代码”: “417” 连接到主机的 #0 apple-pay-gateway.apple.com 完好无损 }
0
0
108
2w
Need Apple Pay test cards for failed cases (insufficient balance, etc.) on sandbox environment
I am currently testing Apple Pay integration on my sandbox environment and I am in need of test cards for failed cases such as insufficient balance. Does anyone have access to or know where I can find Apple Pay test cards specifically for scenarios where transactions fail due to reasons like insufficient balance? Any help or guidance on this matter would be greatly appreciated. Thank you.
0
0
162
2w
Apple pay - determine active card
The documentation states canMakePaymentsWithActiveCard is deprecated but will continue to work on Safari browsers. The suggested method to use applePayCapabilities is in Beta. This is confusing for a developer! which method should be used. I do not want to use a 'Beta' version in a Production environment. On the other hand, I also don't want to use a method which is deprecated. Any help or guidance would be welcome. Thank you
1
0
174
2d
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
I am getting error while await applePayClient.PostAsJsonAsync(validationUrl, validationPayload) I am testing it on local machine. Am I even can test this on local machine or not? Error: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.. validationUrl: https://apple-pay-gateway.apple.com/paymentservices/startSession JS C# code: var applePayClientHandler = new HttpClientHandler { SslProtocols = System.Security.Authentication.SslProtocols.Tls12 | System.Security.Authentication.SslProtocols.Tls13 }; var applePayClient = new HttpClient(applePayClientHandler); var merchantId = "merchant.com.xxxxxx.sandbox"; var _displayName = "Sandbox"; var domainName = "xxxxxx.co"; var validationUrl = request.ValidationURL; var validationPayload = new { MerchantIdentifier = merchantId, DisplayName = _displayName, Initiative = "web", InitiativeContext = domainName }; try { var response = await applePayClient.PostAsJsonAsync(validationUrl, validationPayload); var merchantSession = await response.Content.ReadAsStringAsync(); return merchantSession; } catch (HttpRequestException httpEx) { // Log detailed HTTP request/response information Console.WriteLine($"HttpRequestException: {httpEx.Message}"); if (httpEx.InnerException != null) { Console.WriteLine($"InnerException: {httpEx.InnerException.Message}"); } throw; }
0
0
173
3w
Apple Pay 115% limit
Hi. About to start integrating Apple Pay for the first time. Other gateways I've integrated have a limit from the initial authorisation, above which you can't capture payment. E.g. customer authorizes £100, but then adds items to their order taking the value to £120. Is there such a limit with Apple Pay? Is there a workaround without having to contact the customer again. Jon
0
0
154
3w
Hide ApplePay button on non supporting devices
Hi, I'm adding ApplePay to our website. It works perfectly. However, I want to hide the ApplePay button on devices that do not have an Apple Wallet configured. I am using the following code to verify this as per ApplePay documentation. function ShowApplePayButton() { if (window.ApplePaySession) { if (ApplePaySession.canMakePayments()) { if (ApplePaySession.canMakePaymentsWithActiveCard('visa') || ApplePaySession.canMakePaymentsWithActiveCard('masterCard')) { return true; } } } return false; } This function always returns true from a Mac with no wallet configured. So the applePay button is visible on the Mac. When I click on the ApplePay button, there is no option to add or update the Wallet. This is my ApplePay sample code function onApplePay() { if (!ApplePaySession) { return; } var grandTotal = "10"; // Define ApplePayPaymentRequest const request = { countryCode: 'GB', currencyCode: 'GBP', merchantCapabilities: ['supports3DS'], supportedNetworks: ['masterCard', 'visa'], total: { label: 'Total', amount: grandTotal, type: 'final' }, requiredBillingContactFields: ["postalAddress", "name", "phone", "email"], requiredShippingContactFields: ["postalAddress", "name", "phone", "email"] }; // Create ApplePaySession const session = new ApplePaySession(3, request); session.onvalidatemerchant = async event => { // Call your own server to request a new merchant session. const merchantSession = await getAsync("/test/ValidateMerchant", "", "json") session.completeMerchantValidation(merchantSession); }; session.onpaymentmethodselected = event => { const update = { newTotal: { label: 'Total', amount: grandTotal, type: 'final' } } session.completePaymentMethodSelection(update); }; session.onshippingmethodselected = event => { const update = { newTotal: { label: 'Total', amount: grandTotal, type: 'final' } }; session.completeShippingMethodSelection(update); }; session.onshippingcontactselected = event => { }; session.onpaymentauthorized = event => { const result = { "status": ApplePaySession.STATUS_FAILURE }; const payment = event.payment; aj.post('/test/ProcessPayment', body, function (response) { if (response.approved) { session.completePayment(ApplePaySession.STATUS_SUCCESS); } else { session.completePayment(ApplePaySession.STATUS_FAILURE) } }, function (xhr, ajaxOptions, thrownError) { console.log(thrownError); }, true, 'json'); }; session.oncancel = event => { // Payment canceled by WebKit }; session.begin(); } Could you please suggest a workaround to resolve this issue?
2
1
229
Jun ’24
Intermittent merchant validation
Hello, I've recently created a merchant ID and added two domains to it. I placed the verification .txt files in the right place (under the .well-known dir) and both verified successfully and show as such in the merchant id setup page. I am intermittently getting the following error: { "statusMessage": "Payment Services Exception merchantId=XXXXX not registered for domain=my.domain.com", "statusCode": "400" } (merchantId and domain have been masked in the above error) -- What's odd is that this is intermittent -- It'll work fine, and then stop and start giving the above error, and then start working fine again, with no intervention from me. Some context: This is a single server application, so it's not like we've got a server out of sync somewhere. Thoughts? Any thoughts?
3
2
359
Jun ’24
PaymentRequest TypeError
Details at Stack Overflow We're trying to enable Apple Pay on the Web for a web application of ours, but getting this error when trying to construct the PaymentRequest object: TypeError: Type error: PaymentRequest@[native code] startApplePay@https:-myurl-:319:47 onclick@https://-myurl-:606:14:undefined
1
0
369
Jun ’24
Apple Pay guidelines clarification
Hello there, I have a couple of question about Apple Pay guidelines: • if we offer Apple Pay payment method in our app, can we disable the selection (I mean the method selection NOT the Payment button!) IF certain condition happens? E.g. the user cannot select apple pay payment method because our basket is not ready yet. • Are we forced to move the apple pay payment method on the top of our selection? E.g. Cards, Cash On Delivery, Coupon, Apple Pay --> Apple Pay, Cards, Cash On Delivery, Coupon One last technical question: • when we start the payment process we are gonna create the request and present the sheet BUT we have to call our backend for pre-authorization, is it allowed? @objc private func applePayButtonTapped(sender: UIButton) { // TODO: Is it allowed? // We need to ask to our backend a pre-authorization and THEN procced with Apple Pay flow // but this could be done ONLY after the user TAP on BUY with APPLE PAY and BEFORE // paymentAuthorizationViewController is called. // Are we compliant to do that? if PKPaymentAuthorizationViewController.canMakePayments(usingNetworks: FakeData.paymentInfo()) { let request = PKPaymentRequest() request.blablabla = blabla let authorizationViewController = PKPaymentAuthorizationViewController(paymentRequest: request) if let viewController = authorizationViewController { viewController.delegate = self present(viewController, animated: true, completion: nil) } } } Thanks in advance :)
0
0
394
May ’24
adding ApplePayDeferredPaymentRequest request is cancelled
Hi, I'm adding deferredPaymentRequest container to get MPan, but payment is now cancelled by Webkit, no other explanation What is the next step to get mpan ? Regards, Louis "deferredPaymentRequest": { "deferredBilling": { "label": "Deferred Payment", "amount": "1.99", "type": "final", "paymentTiming": "deferred", "deferredPaymentDate": "2024-06-1", }, "managementURL": 'https://.../apmsim/pay/appleManagement', "paymentDescription": "this is a paymentDescription", }
0
0
285
May ’24
Sandbox tester account not able to add test cards for testing
Hello team , We have created a sandbox tester and added all the setting as per the guidelines but the sandbox tester account is blocked from adding the test card . All the test cards show as invalid card . We are not able to able to add wallet from iCloud . We are not able to sign into iTunes with the sandbox tester account . Please help on how to resolve this . Thanks in Advance
0
0
318
May ’24
Unable to create Sandbox Apple IDs
I have a Developer account with a Developer Role, although apparently without the stated ability to create my own Sandbox ID. So, our company's Administrator is trying to create one for me. But each time he enters a new icloud.com address to create one, he gets the error, "Your Apple ID or password was entered incorrectly." (The example at the above link uses icloud.com, and that seems the natural place to do this. I'm assuming that since you can't actually create an icloud.com email without an Apple ID, that this sandbox creation process should be ok with the email not existing yet.)
1
0
399
May ’24