razorpay / razorpay-go

Razorpay Go SDK
MIT License
39 stars 25 forks source link

No instructions to get razorpay go package in tutorial #36

Open schadokar opened 2 years ago

schadokar commented 2 years ago

In tutorial it is very vague. No instructions on how to get the razorpay package.

Attach a working repo which can be cloned.

ankitdas13 commented 2 years ago

@schadokar We apologise for the issue you're experiencing and thanks for reporting it. Hope you've resolved this issue. but if someone else facing same issue while integration. Please follow this steps

mkdir testapp

go mod init main

create main.go file & add

package main
 import (
    "fmt"
    "encoding/json"
    razorpay "github.com/razorpay/razorpay-go"
 )

func main(){
    client := razorpay.NewClient("key", "secret")
        data := map[string]interface{}{
        "amount": 50000,
        "currency": "INR",
        "receipt": "some_receipt_id",
        "partial_payment": false,
        "notes": map[string]interface{}{
            "key1": "value1",
            "key2": "value2",
          },
      }
    body, err := client.Order.Create(data, nil)

    jsonString, err1 := json.Marshal(body)
        fmt.Println(string(jsonString))
        fmt.Println(err1)
    fmt.Println(err)
}

go mod tidy

go run main.go