我想将发票编号添加到PayPal PLUS订单中。我尝试了以下请求:
if($this->config->get('pp_plus_test') == 1)
{
$mode= ".sandbox";
} else {
$mode= "";
}
$fields2 = '[{
{
"op": "add",
"path": "/transactions/0/invoice_number",
"value": {
"invoice_number": "125478"
}
}
}]';
if($this->config->get('pp_plus_test') == 1){
$mode= ".sandbox";
} else {
$mode= "";
}
$ch2 = curl_init();
$headers=array('Content-Type:application/json','Authorization:Bearer '.$this->getToken());
curl_setopt($ch2, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch2, CURLOPT_URL, "https://api".$mode.".paypal.com/v1/payments/payment/".$this->session->data['createPaymentArrID']);
curl_setopt($ch2, CURLOPT_HEADER, false);
curl_setopt($ch2, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch2, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch2, CURLOPT_POSTFIELDS, $fields2);
$result2 = curl_exec($ch2);
并获得此回复:
{"name":"MALFORMED_REQUEST","message":"Incoming JSON request does not map to API request","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#MALFORMED_REQUEST","debug_id":"125482c756fe1"}
有人可以告诉我该请求有什么问题吗?