I am thinking about making a plugin for PayPal using their REST API.
Following their documentation:
https://developer.paypal.com/docs/integration/direct/make-your-first-call/
I made this function to get the access token:
function getAccessToken() local function networkListener( event ) if ( event.isError ) then print( "getAccessToken: Network error!" ) print ( "RESPONSE: " .. event.response ) else print ( "RESPONSE: " .. event.response ) end end local headers = {} headers["Content-Type"] = "application/x-www-form-urlencoded" headers["Accept-Language"] = "en-US" headers["Accept"] = "application/json" headers["Authorization"] = "Basic QVZzQblablabla" local body = "grant\_type=client\_credentials" local params = {} params.headers = headers params.body = body network.request( "https://api.sandbox.paypal.com/v1/oauth2/token", "POST", networkListener, params ) end
I get the following in the response:
“Certificate required”
I tried the call with POSTMAN and it worked.
What am I doing wrong in this Lua code?