Giving “PAYMENT_STATE_INVALID” on payment execution even if the payment state is "approved"

Discussion in 'PayPal' started by sowndaryalak, May 15, 2017.

  1. #1
    On Execution of the payment giving error as

    {
    "name": "PAYMENT_STATE_INVALID",
    "message": "Request is invalid for current payment state.",
    "information_link": "https://developer.paypal.com/webapps/developer/docs/api/#PAYMENT_STATE_INVALID",
    "debug_id": "621987c99cbee"
    }

    The Payment is already in approve state Response for the payment is

    {
    "id": "PAY-49H97458KE3710939LELKB4Q",
    "create_time": "2017-05-13T06:00:18Z",
    "update_time": "2017-05-13T06:00:22Z",
    "state": "approved",
    "intent": "sale",
    "payer": {
    "payment_method": "credit_card",
    "funding_instruments": [
    {
    "credit_card": {
    "type": "xxxx",
    "number": "xxxxxxxxxxxxxxxx",
    "expire_month": "x",
    "expire_year": "xxxx",
    "first_name": "xxxxxxxx",
    "last_name": "xxxxx"
    }
    }
    ]
    },
    "transactions": [
    {
    "amount": {
    "total": "0.01",
    "currency": "USD",
    "details": {
    "subtotal": "0.01"
    }
    },
    "description": "The payment transaction description.",
    "related_resources": [
    {
    "sale": {
    "id": "7NF6682256719761C",
    "create_time": "2017-05-13T06:00:18Z",
    "update_time": "2017-05-13T06:00:22Z",
    "amount": {
    "total": "0.01",
    "currency": "USD"
    },
    "state": "completed",
    "parent_payment": "PAY-49H97458KE3710939LELKB4Q",
    "links": [
    {
    "href": "https://api.sandbox.paypal.com/v1/payments/sale/7NF6682256719761C",
    "rel": "self",
    "method": "GET"
    },
    {
    "href": "https://api.sandbox.paypal.com/v1/payments/sale/7NF6682256719761C/refund",
    "rel": "refund",
    "method": "POST"
    },
    {
    "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-49H97458KE3710939LELKB4Q",
    "rel": "parent_payment",
    "method": "GET"
    }
    ]
    }
    }
    ]
    }
    ],
    "links": [
    {
    "href": "https://api.sandbox.paypal.com/v1/payments/payment/PAY-49H97458KE3710939LELKB4Q",
    "rel": "self",
    "method": "GET"
    }
    ]
    }

    And giving the response as approved because of using the credit card. Is it the valid scenario? On using the payment method as "PayPal" response is showing as payment created. And is there any api for transfer of money from one paypal account to another through sandbox? And also is there any api to add the debit/ credit/ bank to our account?
     
    sowndaryalak, May 15, 2017 IP