paypal

Paypal rest api - what are the possible payment states?


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);
        }

    });;

Solution

  • 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