Trying to make a request to Paypal's API using PayPal-node-SDK
exports.requestPayment = functions.https.onRequest((req, res) => { return new Promise(function (fullfilled, rejected) { paypal.payment.create(create_payment_json, {}, function (error, payment) { if (error) { rejected(error); } else { console.log("Create Payment Response"); console.log(payment); res.status(200).send(JSON.stringify({ paymentID: payment.id })).end(); fullfilled(payment); } }); }); });
but I'm constantly getting an error:
Error: getaddrinfo ENOTFOUND api.sandbox.paypal.com api.sandbox.paypal.com:443 at errnoException (dns.js:28:10) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:76:26)
Things I've tried:
ENOTFOUND
cors(req,res, ()=>{...})
https://
to the hostWhat is the problem?
You should use Cloud Functions for Firebase if you're a developer building a mobile app or mobile web app. Firebase gives mobile developers access to a complete range of fully managed mobile-centric services including analytics, authentication and Realtime Database.
Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your JavaScript or TypeScript code is stored in Google's cloud and runs in a managed environment.
You'll need to be on a paid plan to make external API requests.
Firebase's Blaze plan (pay as you go) has a free allotment for Cloud Functions. https://firebase.google.com/pricing/
in my situation I had to wait and let what ever lag was happening pass. Now it's fine again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With