razorpay / razorpay-python

Razorpay Python SDK
https://pypi.python.org/pypi/razorpay
MIT License
153 stars 81 forks source link

payment refund issue #264

Open mesky-tech opened 10 months ago

mesky-tech commented 10 months ago

in rest api its working fine but when i do call with client sdk getting this error everytime razorpay.errors.BadRequestError: The amount must be an integer.

client.payment.refund(,{"amount": "100","speed": "optimum","receipt": "#Receipt No. 132"})

jeromtom commented 10 months ago

I don't think the 100 should be in quotes which makes it a string instead of an integer. Try this client.payment.refund(,{"amount": 100,"speed": "optimum","receipt": "#Receipt No. 132"})

NagariaHussain commented 3 months ago

After spending a lot of time with the same error, I found out the implementation and docs have mismatch:

Docs: CleanShot 2024-05-02 at 12 25 35@2x

Implementation: CleanShot 2024-05-02 at 12 24 53@2x

Since amount is not mandatory (full refund case), it makes sense to change the implementation.

santanu2310 commented 3 months ago

Yes, there is a mismatch in the docx and code. I already make a pull request containing the fix

you need to pass payment_id and amount as a positional argument not in the data dictionary client.payment.capture(payment_id, amount, {...})