Post JSON using postURL (to PayPal) - nested/multilevel JSON

Post JSON using postURL (to PayPal) - nested/multilevel JSON

I am trying to make a POST to paypal.

As I understand ZOHO functions cannot handle multilevel or nested JSON strings.  So I have had to create my JSON string manually.  I believe the string to be formulated correctly, however when I run my custom function I get the following response in return>

"responseCode":"400","responseText":"The request had bad syntax or was inherently impossible to be satisfied."

I am pretty confident that my JSON is formatted correctly for the required POST>

Here is the documentation link>
https://developer.paypal.com/docs/integration/direct/create-single-payout/

Here is a sample of my HeaderMapVariable (with Access key scrubbed)>
{
  • "Authorization":"Bearer A101.GlaVuJsANIf8zietZFUNaaxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.Ikb28Df63uYCiiWSwrL142u0B_8",
  • "Content-Type":"application/json"
}

Here is the detailJSONString - created by combining strings as multilevel/nested JSON is not supported

{
  • "sender_batch_header": {
    • "email_subject":"Great News: Payment Received from US",
    • "sender_batch_id":"12345678",
    • "recipient_type":"EMAIL"
    },
  • "items": [
    1. {
      • "recipient_type":"EMAIL",
      • "amount": {
        • "value":"100.00",
        • "currency":"USD"
        },
      • "note":"Thanks for working together with us",
      • "sender_item_id":"1234567",
      • "receiver":"nickbh@n.co.uk"
      }
    ]
}

Here is a the call I make from the function>


//
//
info PayPalAPIResponsePayout;
//
//


As I said, I get the following response>
"responseCode":"400","responseText":"The request had bad syntax or was inherently impossible to be satisfied."

Ive been looking at the issue for ages.  I have tried loads of debugging, but cannot find the issue. 

I have made other calls to PayPal - the first one was to get the access-token and that works fine.  the only diffrence is that that call uses all maps() and not a string I have created. 

Any help greatly appreciated.

Thanks