API: Capturing a Transaction - Understanding whether payment has been successful

boris25
Contributor
Contributor

Hi, I'm building a Smart Payment Buttons integration but doing the Create and Capture using the REST API SDK for PHP V2.

 

When capturing the transaction, how do I know payment is successful?

 

$capture_request = new OrdersCaptureRequest($orderId);

try {
$client = new PayPalHttpClient($this->environment);
$response = $client->execute($capture_request);
}
catch(HttpException $exception){

// Process has failed return error to client
}

// Point X - How I do know payment has been successful?

 

The code in the repo shows checking for a 201 at 'Point X' as a measure of success, but does that just indicate that the process is successful not necessarily the payment?

 

At 'Point X' I want to return to the client whether 'all is good' or 'gone wrong try again' what do I need to be looking for? The API lists response status values of CREATED, SAVED, APPROVED, VOIDED, COMPLETE. Do I just need to look for APPROVED and COMPLETE?

 

many thanks
Boris

Login to Me Too
1 REPLY 1

shawnz
Contributor
Contributor

Having the same issue. I don't want to resort to using the deprecated NVP APIs in my app, but I'm not sure this new API is ready for primetime when it's not even clear how to tell if a transaction was successful or not. Please provide some clarified documentation on this absolutely essential issue, otherwise I just don't see how I will be able to use this API.

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.