Post

Replies

Boosts

Views

Activity

Reply to Unable to get any response from the apple pay - This resource came from a local override
Hi All, Able to resolve the {"size":0,"timeout":0} issue and it is related to node fetch library. I fixed it from my code level. Apart from that, I used the below request to debug using the remote server, and It was giving the session object to me. curl -XPOST -H "Content-type: application/json" -d '{"merchantIdentifier":"merchant.***.xxxxx","displayName":"Test Pay","initiative":"web","initiativeContext":"***-***-xxxxxx.xxxxxxxxxx.xx"}' --cert cert.pem:cert.pem 'https://apple-pay-gateway-cert.apple.com/paymentservices/startSession' my code: import fetch from "node-fetch" import fs from "fs" import { promiseReject } from "../utils/misc" import { Logger } from "../services/Logger" import https from "https" const logger = new Logger("Apple Pay Client") const checkStatusAndGetJSON = (fetchResponse) = fetchResponse.ok ? fetchResponse.json() : fetchResponse.json().then(promiseReject) const merchIdentityCert = fs.readFileSync("./merchIdentityCert.pem") const httpsAgent = new https.Agent({ cert: merchIdentityCert, key: merchIdentityCert, maxVersion: "TLSv1.2", minVersion: "TLSv1.2" }) const basicHeaders = { "Accept": "application/json", "lang": "en", "Content-Type": "application/json" } const post = (url, body) = { const start = Date.now() return fetch(url, { body: JSON.stringify(body), headers: basicHeaders, method: "POST", agent: httpsAgent }).then(resp = { const duration = Date.now() - start logger.debug(`apple pay call took ${duration} millis.`, { endpoint: url, method: "POST", duration }) return resp }).then(checkStatusAndGetJSON) } /** Apple Pay */ export const performValidation = (url, body) = post(url, body) I hope this will help someone. Thanks for the support!!!
May ’21
Reply to Unable to get any response from the apple pay - This resource came from a local override
In Our architecture, Normally we are sending requests from the Client → FEBE → Server. Here, FEBE is a node server and we are using it as a middle API to process requests and responses between Client and Server.  We have deployed our Client app and FEBE(node server) in AWS servers on the same host. ( FEBE and Client are in the same docker) When I am running the payment session request, It is going to FEBE(node server) from the Client and then hitting the apple pay servers to get the session object. I'm sending the request from the FEBE and it will be triggered by the Client. My FEBE logs (server-side) are; My Server Logs message: "apple pay START", url: "https://-pay-gateway-cert.apple.com/paymentservices/startSession", body: {"merchantIdentifier":"***.*.****", "displayName":"Test Pay", "initiative":"web","initiativeContext":"*-*-.**."} message: "apple pay SUCCESS", resp: {"size":0,"timeout":0} My Code import fetch from "node-fetch" import fetch from "node-fetch" import fs from "fs" import { Logger } from "../services/Logger" import https from "https"   const logger = new Logger("Apple Pay Client")   const merchIdentityCert = fs.readFileSync("./merchIdentityCert.pem")   const httpsAgent = new https.Agent({    cert: merchIdentityCert,    key: merchIdentityCert,    maxVersion: "TLSv1.2",    minVersion: "TLSv1.2" })   const post = (url, body) = {    logger.info({ message: "apple pay START", url, body })    return fetch(url, {        body: JSON.stringify(body),        method: "POST",        agent: httpsAgent    }).then(resp = {        logger.info({ message: "apple pay SUCCESS", resp })        return resp    }).catch((error) = {        logger.info({ message: "apple pay ERROR", error })        return error    }) }   /** Apple Pay */ export const performValidation = (url, body) = post(url, body)
May ’21
Reply to Unable to get any response from the apple pay - This resource came from a local override
message: "apple pay SUCCESS", resp: {"size":0,"timeout":0} is not an expected response after requesting a session. But I am not getting an error also. Does anyone have an idea? find my URL and request payload: message: "apple pay START", url: "https://-pay-gateway-cert.apple.com/paymentservices/startSession", body: {"merchantIdentifier":"***.*.****","displayName":"Test Pay","initiative":"web","initiativeContext":"*-*-.**."} What is the issue from my side?
May ’21
Reply to Unable to get any response from the apple pay - This resource came from a local override
Thank you for the guide. There was an issue with the private key of my merchIdentityCert and I fixed it. After installing the .cer file, expand it from the Keychain Access, and export 2 items as .p12 and convert it to .pem using OpenSSL. Now, I have a PEM file that contains both assets. Then I continued my process and didn’t get the below error in this time which I mentioned in the above post. message: "apple pay ERROR", error: {} But, After the request, I am getting below log, message: "apple pay SUCCESS", resp: {"size":0,"timeout":0} As well, In the Inspect Element → Network → (click on my request) → Preview Top of the response Preview, It is displaying a message as “Reveal | This resource came from a local override” const merchIdentityCert = fs.readFileSync("./merchIdentityCert.pem") const httpsAgent = new https.Agent({ cert: merchIdentityCert, key: merchIdentityCert, maxVersion: "TLSv1.2", minVersion: "TLSv1.2" }) const post = (url, body) = { logger.info({ message: "apple pay START", url, body }) return fetch(url, { body: JSON.stringify(body), method: "POST", agent: httpsAgent }).then(resp = { logger.info({ message: "apple pay SUCCESS", resp }) return resp }).catch((error) = { logger.info({ message: "apple pay ERROR", error }) return error }) }
May ’21