Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Paypal rest api - what are the possible payment states?

Tags:

paypal

I am trying to simulate a payment using the paypal rest api. After calling execute I get a response object with the state "approved".

Does anyone know where there is a list of the possible states the api may return?

I presume there are a few others but I can not find the documentation that covers this.

paypal.payment.execute(payment_id, details, function (err, payment) {
        if(err){
            throw err;
        }
        if(payment.state === "approved"){
            done(err, payment);
        }else{
            //handle other states
            done(err, payment);
        }

    });;
like image 348
Chin Avatar asked Dec 07 '13 02:12

Chin


1 Answers

UPDATE: My previous answer is obsolete.

RIGHT ANSWER As of June-2018

Looks like Paypal REST API have undergone some updates, and the state assigned to the Response are just 3.

Possible values: created, approved, failed.

enter image description here

Source: Docs: Payments API > Payment > Create payment

2013 Answer [ OBSOLETE ]. Useful only if you are using old version of API

According to the REST API Documentation for Create a payment, the state assigned in the Response can be any one of the following.

created 
approved
failed
canceled
expired
like image 162
Shiva Avatar answered Nov 03 '22 20:11

Shiva