skip to Main Content

When I tried these values in price and amount fields, it gives an error. It works fine if the value is not a float or decimal:
code :

    "intent": "sale",
    "payer": {
        "payment_method": "paypal"
    },
    "redirect_urls": {
        "return_url": "http://localhost:2300/success",
        "cancel_url": "http://localhost:2300/cancel"
    },
    "transactions": [{
        "item_list": {
            "items": [{
                "name": "Item",
                "sku": "Item",
                "price": '0.0015',
                "currency": "INR",
                "quantity": 1
            }]
        },
        "amount": {
            "currency": "INR",
            "total": '0.0015'
        },
        "description": 'Item description.'
    }]
};

Error :
response:
{ name: 'VALIDATION_ERROR',
message: 'Invalid request - see details',
debug_id: 'f42749ec22229',
information_link: 'https://developer.paypal.com/docs/api/payments/#errors',
details: [ [Object] ],
httpStatusCode: 400 },
httpStatusCode: 400 }

2

Answers


  1. Chosen as BEST ANSWER

    It worked! Thank you all for help. I used "Math.round((100.01151)*100)/100;" for price and total amount which gives 100.01.


  2. You should be printing out details: [ [Object] ], If you look into that details array of the JSON response, it should say INVALID_CURRENCY_AMOUNT_FORMAT

    Most PayPal-supported currencies, INR included, only allow two decimal places, i.e. nothing smaller/beyond .01

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search