Hi all

I've been trying to help Edgar with a PayPal call. It is defined here.

As it shows on that page, the following curl command works (on my Win7, Win10 and Mac - I had to replace ' with " from that example to get it to play nice in the Windows Command Prompt):
curl -X POST "https://api.sandbox.paypal.com/v1/oauth2/token" -H "accept: application/json" -H "accept-language: en_US" -H "authorization: basic QWJ***...***eW4=" -H "content-type: application/x-www-form-urlencoded" -d grant_type=client_credentials
It also works in Postman on my Mac and on my Win7 VM, both passing "grant_type=client_credentials" as a x-www-form-urlencoded body or as a query string. Strangely, on my Win10 Postman it just hangs on the call until I click "Cancel" (both ways) - not sure why.

However the following DF code fails - the HttpVerbAddrRequest returns zero every time - in both Win7 and Win10 VMs:
    Object oTrans is a cCharTranslate
    Object oHttp is a cHttpTransfer
        Property UChar[]  pucaData
        Property String   psContentType
        Set psRemoteHost    to "api.sandbox.paypal.com"
        Set piRemotePort    to rpHttpSSL
        Set peTransferFlags to ifSecure
        Procedure OnDataReceived String sContentType String sData
            UChar[] ucaData
            Get pucaData        to ucaData
            Set pucaData        to (AppendArray(ucaData, StringToUCharArray(sData)))
            Set psContentType   to sContentType            
        Procedure Reset
            UChar[] empty
            Set pucaData        to empty
            Set psContentType   to ""
            Send ClearHeaders
    Function PayPalToken String sUsername String sPassword Returns Boolean
        String  sToken sPath sQuery
        Integer iOK iResp
        Boolean bOK
        UChar[] ucaData
        Handle  hoJson
        stPayPalToken tPPToken
        Send Reset of oHttp
        Move (Trim(sUsername) + ":" + Trim(sPassword))                              to sToken
        Move (Base64EncodeToStr(oTrans, AddressOf(sToken), Length(sToken)))         to sToken
        Move "v1/oauth2/token"                                                      to sPath
        Move "grant_type=client_credentials"                                        to sQuery

        Get AddHeader of oHttp "accept" "application/json"                          to iOK
        Get AddHeader of oHttp "accept-language" "en_US"                            to iOK
        Get AddHeader of oHttp "authorization" ("basic" * sToken)                   to iOK
        Get AddHeader of oHttp "content-type" "application/x-www-form-urlencoded"   to iOK
        Get HttpVerbAddrRequest of oHttp sPath (AddressOf(sQuery)) (Length(sQuery)) False "POST" to iOK
        // or I can try:
        //   Get HttpVerbAddrRequest of oHttp (sPath + "?" + sQuery) 0 0 False "POST" to iOK
        // to pass the input in the query-string instead of the post body - same result  :-(

        If iOK Begin  // iOK is always zero
The function PayPalToken gets passed the "Client ID" (sUsername above) and "Secret" (sPassword above) and generates a basic base64-encoded token that I've checked is the same as those used in the curl and Postman calls which work, but in any event it isn't even generating an error from the service - the call just fails.

I assume that I'm just missing something obvious and can't see it for looking at it.