Hi all,
so I'm working on an app that requires me to implement PayPal as a way to payout money to its users. I had originally looked into PlayFab + PayPal's Express Checkout, but that seems to only allow users to purchase things (but if I'm wrong, please correct me!). I actually want the users to have the ability to have money sent directly to their PayPal accounts.
As a test, I wrote up a simple http request in CloudScript, to see if I can connect to PayPal. I've tested this request in Postman, and I have it working successfully, where it will return a JSON with some data in it! However, when I make this call with CloudScript, then use ExecuteCloudScript in my app, the FunctionResult returns this: {"responseContent":""}. It's empty!
I guess my question is: am I doing something wrong in my request? I've never really made an http request before, so I feel like I'm probably missing something straightforward.
and just so everyone knows, the "Bearer {...}, Basic {...}" is populated with my bearer token, and basic auth info. I changed them to {...} for privacy reasons.
handlers.withdrawPayPal = function (amount) { var headers = { "authorization": "Bearer {...},Basic {...}=", "accept":"application/x-www-form-urlencoded", "cach-control": "no-cache" }; var body = { "grant_type": "client_credentials" }; var url = "https://api.sandbox.paypal.com/v1/oauth2/token"; var content = JSON.stringify(body); var httpMethod = "POST"; var contentType = "application/x-www-form-urlencoded"; // The pre-defined http object makes synchronous HTTP requests var response = http.request(url, httpMethod, content, contentType, headers); return { responseContent: response }; };