Cannot capture amounts after DoExpressCheckoutPaym

2019-08-16 01:20发布

问题:

I user PayPal's Express Checkout API to make an parallel Payment. Everything works fine, on the payee site, the 2 payments are booked as "open".

While DoExpressCheckoutPayment I get an transaction id for each payment. But a doCapture fails with "You%20do%20not%20have%20permissions%20to%20make%20this%20API%20call". A single authorized payment that I made several weeks ago but have never captured gives me just "Order%20has%20expired%2e" - which is fine.

I use the following parameters for the NVP API:

    $parameters = array("METHOD"=>"DoCapture",
                "AUTHORIZATIONID"=>$transactionid_item,
                "AMT"=>$amt_item,
                "CURRENCYCODE"=>$currencycode,
                "COMPLETETYPE"=>"Complete"
               );

when of course the variable are the corresponding values to each payment. (plus authentication/api credential).

What am I doing wrong? Is there an additional variable to set when I make a parallel instead of an single payment?

regards,

chris

This is an example call and the response:

https://api-3t.sandbox.paypal.com/nvp?METHOD=DoCapture&AUTHORIZATIONID=O-67121848EA448750G&AMT=9.70&CURRENCYCODE=EUR&COMPLETETYPE=Complete&USER=xxx&PWD=xxx&SIGNATURE=xxx&VERSION=95.0

array(9) {
  ["TIMESTAMP"]=>
  string(28) "2013%2d06%2d15T09%3a35%3a52Z"
  ["CORRELATIONID"]=>
  string(12) "140dec053198"
  ["ACK"]=>
  string(7) "Failure"
  ["VERSION"]=>
  string(6) "95%2e0"
  ["BUILD"]=>
  string(7) "6444009"
  ["L_ERRORCODE0"]=>
  string(5) "10007"
  ["L_SHORTMESSAGE0"]=>
  string(19) "Permission%20denied"
  ["L_LONGMESSAGE0"]=>
  string(67) "You%20do%20not%20have%20permissions%20to%20make%20this%20API%20call"
  ["L_SEVERITYCODE0"]=>
  string(5) "Error"
}

回答1:

It looks like you are running your Express Checkout API call as an order, then you are turning around and doing a DoCapture request but you are passing over the order id for the auth id instead of the authorization id. If you are wanting to set your Express Checkout to be an order instead of an auth or a sale, then you need to perform the calls in the following ways.

SetExpressCheckout API call (processing as order)
GetExpressCheckoutDetail API Call
DoExpressCheckoutPayment API Call (processing as order)

DoAuthorization (performs an auth, and passes over the order id that you received from the EC flow)

DoCapture (performs a capture against the auth, you will pass over the auth id that was returned in the previous call here, not the order id)