cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

PayPal Capture of Prior Auth Failing with transaction not found

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.

JChalek
Member
1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

JChalek
Member
3 REPLIES 3

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']
			]
		];
JChalek
Member

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.

JChalek
Member

If you want to auth first and capture later the flow would be:

1. authOnlyTransaction

2. authOnlyContinueTransaction

3. priorAuthCaptureTransaction