/rm-go-client

Simplified version of RevenueMonster payment SDK (Unofficial but elegant)

Primary LanguageGoMIT LicenseMIT

RevenueMonster Go Client

Build Release Go Report Go Coverage LICENSE FOSSA Status

Simplified version of rm sdk.

Apart from the official rm-sdk-go doesn't support context.Context and opentracing, and this repository is mainly to cover this two core elements.

✨ Features

  • simple and mininal (no extra functions other than payment)
  • support Jaeger
  • support context.Context
  • support decentralize access token store
  • include test

📝 How to use?

import (
	"context"
	"io/ioutil"
	"testing"

	"github.com/dchest/uniuri"
	rm "github.com/si3nloong/rm-go-client/v3"
)

func main() {
    ctx := context.Background()
    pk, _ := ioutil.ReadFile("../test/pk.pem")
    pub, _ := ioutil.ReadFile("../test/server_pub.pem")

    client := rm.NewClient(
		rm.Config{
			ClientID:     "1599646279297591629",
			ClientSecret: "NekiDbnNHbHLWdRmbqtwBCqywfYkVVnE",
			PrivateKey:   pk,
			PublicKey:    pub,
			Sandbox:      true, // determine whether it's using sandbox environment
		},
    )

    req := rm.CreatePaymentCheckoutRequest{}
    req.Order.ID = uniuri.NewLen(10)
    req.Order.Title = "Testing #" + req.Order.ID
    req.Order.Amount = 1000
    req.NotifyURL = "https://www.google.com"
    req.RedirectURL = "https://www.google.com"

    res, err := client.CreatePaymentCheckout(ctx, req)
    if err != nil {
        panic(err)
    }
}

📄 License

MIT

Copyright (c) 2021-present, SianLoong Lee

FOSSA Status