Tried to implement, based on the official documentation in razorpay site Code :
11 func indexpageGet(c *gin.Context) {
12
13 client := razorpay.NewClient("rzp_test_zlsYshjhjhjln", "9LtUy4qhghghgh2asp59es")
14
15 data := map[string]interface{}{
16 "amount": 1234,
17 "currency": "INR",
18 "receipt_id": "some_receipt_id",
19 }
20 body, err := client.Order.Create(data)
21 if err != nil {
22 fmt.Println(err)
23 }
24
25 fmt.Println(body)
Compile Error:
./main.go:20:34: not enough arguments in call to client.Order.Create
have (map[string]interface {})
want (map[string]interface {}, map[string]string)
My Observation: function client.Order.Create(data)
required two arguments I confirmed it from razorpay library (see the function definition part). So the solution is I need to pass second argument (extraHeaders
) too.
// Create creates a new order for the given data
func (order *Order) Create(data map[string]interface{}, extraHeaders map[string]string) (map[string]interface{}, error) {
return order.Request.Post(constants.ORDER_URL, data, extraHeaders)
}
The point I am stuck is what is extraHeaders
and what value I need to pass?
based on the comments in the Question, Made 2 things to made it work : (Refer the comments in below code )