curl_exec从Paypal REST Api返回XMLFault

I'm currently using the Paypal REST Api for a mobile app. Here's my code :

$paymentDatas = array(
    "intent" => "sale",
    "redirect_urls" => array(
        "return_url" => "http://example.com/your_redirect_url/",
        "cancel_url" => "http://example.com/your_cancel_url/"
    ),
    "payer" => array("payment_method" => "paypal"),
    "transactions" => array(
        "transactions" => array(
            "total" => ".99",
            "currency" => "USD"
        )
    )
);
$paymentUrl = 'https://api.sandbox.paypal.com/v1/payments/payment';
$initCurl = curl_init();
curl_setopt_array(
$initCurl, array(
        CURLOPT_URL => $paymentUrl,
        CURLOPT_TIMEOUT => $timeout,
        CURLOPT_RETURNTRANSFER => true,
        CURLOPT_SSL_VERIFYPEER => false, //todo: For testing purpose, need tp be removed
        CURLOPT_POST =>true,
        CURLOPT_HTTPHEADER => array(
            'Accept-Language: en_US',
            'Accept: application/json',
            'Authorization: Bearer '.$data['access_token']
        ),
        CURLOPT_POSTFIELDS => json_encode($paymentDatas),
    )
);
$initRet = curl_exec($initCurl);
dd($initRet);
curl_close($initCurl);

And the dd gives me this :

string '<ns1:XMLFault xmlns:ns1="http://cxf.apache.org/bindings/xformat"><ns1:faultstring xmlns:ns1="http://cxf.apache.org/bindings/xformat">java.lang.NullPointerException</ns1:faultstring></ns1:XMLFault>' (length=196)

I've already made others functions for authentication but I'm pretty new with REST and Paypal Api.

I had the same problem.

When changing the POST request to GET everything worked fine. Hope this will help you.