skip to Main Content

I am working on paypal integration. and make a request to provide evidence in disputes action api.I couldn’t make an array of request body which is given below:

curl -v -X POST https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-27803/provide-evidence 
-H "Content-Type: multipart/related; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW" 
-H "Authorization: Bearer Access-Token" 
-F 'input={
    "evidences": [{
      "evidence_type": "PROOF_OF_FULFILLMENT",
      "evidence_info": {
      "tracking_info": [{
       "carrier_name": "FEDEX",
       "tracking_number": "122533485"
   }]
},
"notes": "Test"
}
]
};type=application/json' 
-F '[email protected]'

In this request after -F flag i could not make an array because new structure of this json. would u like to make php array of this request api body?.

This is an array that i try send in request:

[
  'input' => [
  'evidences' => [
      [
          'evidence_type' => 'PROOF_OF_FULFILLMENT',
          'evidence_info' => [
              'tracking_info' => [
                  [
                      'carrier_name' => 'FEDEX',
                      'tracking_number' => '122533485'
                  ]
              ]
          ],
         'notes' => 'Test' 
       ],
     ]
   ]
 ]

2

Answers


  1. In PHP code , as you are try to use curl

            $url = "https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-27803/provide-evidence";
            $data = [
      'input' => [
      'evidences' => [
          [
              'evidence_type' => 'PROOF_OF_FULFILLMENT',
              'evidence_info' => [
                  'tracking_info' => [
                      [
                          'carrier_name' => 'FEDEX',
                          'tracking_number' => '122533485'
                      ]
                  ]
              ],
             'notes' => 'Test' 
           ],
         ]
       ]
     ]
    
            $ch = curl_init($url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);  
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
            $response = curl_exec($ch);
            curl_close($ch);
    

    It’s a basic post request like form submit from html as you need to send.

    for more info you can visit https://www.php.net/manual/en/book.curl.php or can google to use curl with php

    Login or Signup to reply.
  2. I had the same problem, and after communicating with customer service email, he gave me more reference. But at present, it can only be implemented with curl. I tried using postman python requests php, which is not good. This is my curl code.
    Note the @ symbol behind

    [email protected]   this  @
    

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search