Closed wathek closed 10 years ago
Hey @wathek , when you capture funds using https://developer.paypal.com/webapps/developer/docs/api/#capture-an-authorization, if you want to do a partial capture, you can set "is_final_capture":true to indicate that the remaining funds held by the authorization will be released in the funding instrument. Also it might be helpful to post the debug_id here.
Hey @avidas thank you for your response I've set the is_final_capture to true here's my code :
public function captureAuthorize($id, $amnt, $final = true) {
$apiContext = $this->getApiContext();
$amount = new Amount();
$amount->setCurrency("EUR");
$amount->setTotal($amnt);
$captur = new Capture();
$captur->setId($id);
$captur->setAmount($amount);
$captur->setIsFinalCapture($final);
try {
$authorization = Authorization::get($id, $apiContext);
$capt = $authorization->capture($captur, $apiContext);
} catch (Exception $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
}
return ($capt->toArray());
}
and I'm calling the function with the param final set to true.
Does that still give you an exception? Otherwise, if you fetch that authorization later, (the one you captured setting is_final to true) does the state say partially captured or captured. Again, if you get a debug_id, it would be really helpful here. Thanks.
here's the debugid 2118c85c856cc and the state says that it's captured.
The captureAuthorize function works well it doesn't give me any exception. Thanks a lot
If the state says captured, you should not need to void it yourself. The remaining funds on that prior authorization would get released automatically.
ok great this means that the isFinalCapture works ?
Ya that is expected behavior
ok great thank you so much @avidas
I'm having a problem with void function. I've created an authorization and then I captured less than 100% of the amount and now I want to void the remaining funds, so I call the void function like in below :
The $id var contains the authId and I'm getting this return : Got Http response code 400 when accessing https://api.paypal.com/v1/payments/authorization/*********/void.{"name":"AUTHORIZATION_CANNOT_BE_VOIDED","message":"Authorization is in captured state and hence cannot be voided.","information_link":"https://developer.paypal.com/webapps/developer/docs/api/#AUTHORIZATION_CANNOT_BE_VOIDED","debug_id":"***"}
I cannot figure out what's wrong. I've checked the documentation at this link https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/authcapture/
And as described in the Lower Capture Amount :
Any suggestion please ? Thank you