razorpay / razorpay-go

Razorpay Go SDK
MIT License
37 stars 24 forks source link

Create Order Panic Error #22

Closed khanakia closed 1 year ago

khanakia commented 3 years ago

I am using the correct test key and secret and getting error

map[]
%!v(PANIC=Error method: runtime error: invalid memory address or nil pointer dereference)
package main

import (
    "fmt"

    "github.com/razorpay/razorpay-go"
)

func main() {
    client := razorpay.NewClient("rzp_test_9lsYF6ARKRbVbs", "l4KsqSMSB02smJBnVJgZPRmE")
    data := map[string]interface{}{
        "amount":          1234,
        "currency":        "INR",
        "receipt_id":      "some_receipt_id",
        "payment_capture": 1,
    }

    extraHeaders := map[string]string{}

    body, err := client.Order.Create(data, extraHeaders)
    fmt.Println(body)
    fmt.Println(err)

}
salsanej commented 3 years ago

Getting the same error:

map[]
%!v(PANIC=runtime error: invalid memory address or nil pointer dereference)

Is it a working repository or just wasting our time? @amitmahbubani @AbhinavArora95 @venkatvghub

khanakia commented 3 years ago

@salsanej Repo is working but they have bug in error reporting so it will not reveal you actual error from the api. So you just have to make sure are you posting the right data to the api.

If you really want to see the error then you have to make edit to this file for now vendor/github.com/razorpay/razorpay-go/requests/request.go in doRequestResponse func

HarishJagtap commented 3 years ago

@venkatvghub @neera11 I have added a fix for this and created pull request.

dsouzadyn commented 2 years ago

hi can we get this issue fixed on priority

ashwinimanoj commented 2 years ago

Seems to be fixed in #58

ankitdas13 commented 1 year ago

@khanakia Thanks for reporting this issue . It has already been fixed in one of recent releases. Please update to the most recent version to resolve this issue.

Closing this issue for now, Please don't let that stop you from re-opening if the issue is persisting for you.