Open tiwariayush700 opened 3 years ago
Hey @tiwariayush700
One way that works is you create a struct Notes
type Notes struct {
ZipCode string `json:"zipCode"`
}
and when creating an order:
notes := Notes{ZipCode: order.User.ZipCode}
data := map[string]interface{}{
"amount": order.Amount,
"currency": order.Currency,
"receipt": fmt.Sprintf("SY#%s#%d", order.User.ZipCode, order.Id),
"notes": notes,
}
I can vouch for this working.
Hope it helps.
@tiwariayush700 Sorry for the long delay. I haved checked the same api with yours params and i didnt get any error. Might it be fixed. Could you please let us know if you fixed the issue?
Cannot insert map[string]string in notes from razorpay go client. When I am hitting the api manually, it accepts notes as map[string]string type but in client it does not support that.
{ "amount": 1000, "currency": "INR", "receipt": "Receipt no. 1", "notes": { "notes_1": "123145125" } } This request body is valid in create orders api.
But when I replicate in go client using this: paramsMap := map[string]interface{}{ "amount": checkout.Total.Amount(), "currency": checkout.Total.Currency().Code, "receipt": "receipt_1", "notes": map[string]string{"notes_1":"12234125"}, } razorpayOrderMap, err := razorpayClient.Order.Create(paramsMap, nil)
It gives the following err : Notes : source data must be an array or slice, got map