Hi MSDev, Edit: Paypal has helpfully added emojis anywhere you see the happy/sad guy it's ( : S ) (remove spaces) We did get this working eventually. The code is below but needs amending for your setup: CLIENT ID:SECRET ID (This needs to be the IDs from developers.paypal.com of your REST api application. It needs to be base64 encoded first so either write a function for base64 encoding or just use an online tool) Generate payment function is a WIP, just update URL with what endpoint you need to target and include JSON in the POST. function GenerateBearerToken
Set objHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
objHTTP.open "POST", "https://api.sandbox.paypal.com/v1/oauth2/token", false
objHTTP.setRequestHeader "Accept", "application/json"
objHTTP.setRequestHeader "Accept-Language", "en_US"
objHTTP.setRequestHeader "Authorization", "Basic " & "CLIENT ID:SECRET ID"
objHTTP.send "grant_type=client_credentials"
GenerateBearerToken = objHTTP.responsetext
end function
function GeneratePayment
Set objHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP.6.0")
objHTTP.open "POST", "https://api.sandbox.paypal.com/v1/payment-experience/web-profiles/", false
objHTTP.setRequestHeader "Accept", "application/json"
objHTTP.setRequestHeader "Accept-Language", "en_US"
objHTTP.setRequestHeader "Authorization", "Bearer " & GenerateBearerToken
''objHTTP.send SEND JSON HERE
GeneratePayment = objHTTP.responsetext
end function
... View more