I am trying to integrate a PayPal Checkout Express solution, and I am successfully able to receive an authorization, send the customer off to PayPal, and receive back the information. However, when I try to capture this payment, I keep getting transaction not found. I can't for the life of me figure out why. I am supplying back the refTransId, which is the only thing I can see in that entire json to be passed that might identify the transaction. That's if I include the refTransId as a child of transactionRequest. However, the documentation in the api looks like it needs to be directly a child of createTransactionRequest - but when I supply it that way, it gives the error 'The element 'createTransactionRequest' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'refTransId' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. Which is strange because I'm using JSON, not XML.
Any ideas what would cause this problem, or where I'm properly supposed to nest the refTransId in my JSON? This is a priorAuthCaptureTransaction for PayPal.
Solved! Go to Solution.
โ02-22-2018 07:45 AM
OK, in case anyone else ever comes across this problem trying to do a PayPal implementation, I found the solution. Instead of using AuthOnly and then Capture, I had to use AuthAndCapture followed by AuthAndCaptureContinued. Then everything worked. I wish the api documentation were clearer on which things one has to use to get stuff to work.
โ02-23-2018 09:18 AM
If it helps, here is the structure in php before I convert it to JSON that I pass when I get the transaction not found error:
$json = [ 'createTransactionRequest' => [ 'merchantAuthentication' => [ 'name' => $this->apiPublicKey, 'transactionKey' => $this->apiSecretKey, ], 'refId' => $order['Order']['source_id'], 'transactionRequest' => [ 'transactionType' => 'priorAuthCaptureTransaction', 'refTransId' => $order['Order']['charge_id'] ] ] ];
And here's the php before I convert it to JSON that I pass that gives me the invalid child element error:
$json = [ 'createTransactionRequest' => [ 'merchantAuthentication' => [ 'name' => $this->apiPublicKey, 'transactionKey' => $this->apiSecretKey, ], 'refId' => $order['Order']['source_id'], 'transactionRequest' => [ 'transactionType' => 'priorAuthCaptureTransaction' ], 'refTransId' => $order['Order']['charge_id'] ] ];
โ02-22-2018 07:58 AM
OK, in case anyone else ever comes across this problem trying to do a PayPal implementation, I found the solution. Instead of using AuthOnly and then Capture, I had to use AuthAndCapture followed by AuthAndCaptureContinued. Then everything worked. I wish the api documentation were clearer on which things one has to use to get stuff to work.
โ02-23-2018 09:18 AM
If you want to auth first and capture later the flow would be:
1. authOnlyTransaction
2. authOnlyContinueTransaction
3. priorAuthCaptureTransaction
โ02-23-2018 12:36 PM