Search code examples
pythondjangorazorpay

request() got an unexpected keyword argument 'amount' in razorpay integration with django


I am trying to integrate Razorpay with my django application,

As suggested in their documentation I did,

pip install razorpay

and Now I'm trying to create an order by doing,

client = razorpay.Client(auth=("<key>", "<secret>"))
resp = client.order.create(amount=5000, currency='INR', receipt='TR110462011',
                                   payment_capture='1')

But I'm getting,

request() got an unexpected keyword argument 'amount'

I referred, request() got an unexpected keyword argument 'customer'

But it was not much of a help.

What am I doing wrong here?

Thank you for your suggestions.


Solution

  • According to their API documentation here you need to pass a dictionary.

    So, you can just modify your code by wrapping your arguments in dict() and it will work.

    client = razorpay.Client(auth=("<key>", "<secret>"))
    resp = client.order.create(dict(amount=5000, currency='INR', receipt='TR110462011', payment_capture='1'))