Unable to capture a preauthorized amount

realtebo
Contributor
Contributor

In our webabb we ask user to preauth the total amount of an order.

Then the order is evaded a small piece at time, and at each step it is captured only a portion of the total. 

 

We actually cannot capture server side in php.

 

We got

 

{

   "name":"NOT_AUTHORIZED",
   "message":"Authorization failed due to insufficient permissions.",
   "debug_id":"45a665de305d5",
   "details":[
      {
         "issue":"PERMISSION_DENIED",
         "description":"You do not have permission to access or perform operations on this resource."
      
}
   
],
   "links":[
      {
         "href":"https://developer.paypal.com/docs/api/payments/v2/#error-PERMISSION_DENIED",
         "rel":"information_link"
      
}
   
]

}

 

What does this mean!?

 

The PHP code is 

 


$paypal_request = new AuthorizationsCaptureRequest($paypal_authorization_id);
$paypal_request->prefer('return=representation');
$paypal_request->body = json_encode([
'invoice_id' => $order->full_number,
'note_to_payer' => "Order " . $order->full_number,
"amount" => [
"currency_code" => "EUR",
"value" => $order->gross_evaded
],
"final_capture" => $final_capture_flag
]);

$client = $this->paypalClient();
$response = $client->execute($paypal_request);

 

I add more info.

I tried to call

{{HOST}}/v2/payments/authorizations/{{AUTHORIZATION_ID}}/capture

 

using postman.

 

I used basic auth with same client id and client secret used in webapp.

 

Used sandbox host and same authorization_id

 

I sent this as raw body

 

{
  "amount": {
    "value""1.99",
    "currency_code""EUR"
  },
  "invoice_id""INVOICE-123",
  "final_capture"false
}
 
And all went well
 
So what is the authorization problem in from sdk api call response ?
Login to Me Too
1 REPLY 1

inesshop
Contributor
Contributor

Hello , 

I have the same situation , i'm using smart buttons in my front application to create the order , but i have implemented the capture process server side , i wasn't able to do negative testing so i tried to use a real bank generated visa card to do a test with insufficient funds , and i got this error , it sounds like it's related to business account configuration but couldn't find a solution .

did you resolve this problem ? 

Thanks for your help.

Ines

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.