Closed amaan-ahmad closed 1 year ago
Hi maintainers, Can you please review this PR?
@sidag95 @ankitdas13
Hi @amaan-ahmad i will check this code and let you know .
@amaan-ahmad could you please let me know why you are converting the amount into string? Because according to doc the amount should be integer. It does not support decimal.
@amaan-ahmad could you please respond?
Hi @ankitdas13 ,
apologies for the late response.
yes the amount should be int
but my only point is that SDK itself raises exception due to JSON parse error, which shouldn't happen.
Instead the razorpay backend shall return error response.
Hi @amaan-ahmad i got the point, but till now most of the users are sending the amount without Decimal
, like we mentioned in Doc, and then they will get razorpay backend error response if the amount value is in decimal form . We haven't seen any users experience this error TypeError: Object of type Decimal is not JSON serializable
. Even I didn't face this issue until i use Decimal
.
@amaan-ahmad Please let me know if you have any doubts
got you. But I had suggest that support for decimal might be a helpful thing. But in case, if we decide not to support decimal
then we can discard this. Thanks for your time :)
@amaan-ahmad It would be greatly appreciated if you kept contributing in this SDK. Closing this issue for now.
Explanation of the Issue I had given a fix for.
Hi team,
There was an unhandled exception on the client SDK, that if a
Decimal
type is passed as an amount while creating order it raised the following error,TypeError: Object of type Decimal is not JSON serializable
This will be common for Django environment, as I had previously came across the same issue with some other package, thereby contributing a fix. However, the Razorpay backend would anyway return a 400 error stating that
the amount should be int
.