API curl request for refund
panicoschr
Contributor
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
Jun-01-2021
03:00 AM
I am trying to make a partial refund using API. I used API request with client_id and secret and this generated the access token for me.
Then I used this token to make a partial refund as per the code below
$amount = ['total' => $refundAmountwithVAT, 'currency' => 'USD'];
$array = ['amount' => $amount, 'invoice_number' => $invoiceNo, 'description' => 'test'];
$data = json_encode ($array);
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api-m.sandbox.paypal.com/v1/payments/sale/' . $transactionId . '/refund',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json",
"Authorization: Bearer " . $token,
),
));
and I got this response.
{"name":"PERMISSION_DENIED","message":"Permission denied.","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"fc82da1551cd5"}
Can you please help?
Thanks
Labels:
- Labels:
-
Refunds
0 REPLIES 0
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
Related Content
- Getting money back from Ebay in Payments Archives
- request for refund in Payments Archives
- refund request in My Account Archives
- I wont to recieve a 20,000 $ from china in my Paypal to appear as Paypal Balance in Payments Archives
- How do i refund on paypal when my 8 year old brought something without my consent in Payments Archives