Skip to content

Unofficial golang library for GMO Payment Gateway

License

Notifications You must be signed in to change notification settings

tuannv1807/gmo-payment-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GMO Payment API Client for Go: Unofficial

Simple Golang wrapper for GMO Payment Gateway API.

Installation

$ go get github.com/koffe0522/gmo-payment-go

Support API

  • credit card payment
    • EntryTran.json
    • ExecTran.json
    • AlterTran.json
    • ChangeTran.json
    • SearchTrade.json

Usage

Import

import "github.com/koffe0522/gmo-payment-go/gmopg"
package main

import (
	"fmt"
	"gmo-payment-go/gmopg"
)

func main() {
	shop := gmopg.Init(&gmopg.GmopgConfig{
		// defaultURL
		// baseURL: "https://pt01.mul-pay.jp"
		siteID:   "SiteID",
		shopID:   "SitePass",
		sitePass: "ShopID",
		shopPass: "SitePass",
	})

	orderID := "Order-gmo-payment-go"
	amount := 19800

	entryRes, err := shop.EntryTran(&gmopg.EntryTranArgs{
		OrderID: orderID,
		JobCd:   gmopg.JAuth,
		Amount:  amount,
	})

	if err != nil {
		fmt.Println(err.Error())
		return
	}

	if len(entryRes.Error) > 0 {
		fmt.Println(entryRes.Error)
		return
	}

	cardNo := "1234123412341234"
	expire := "2024"
	securityCode := "123"
	execRes, err := shop.ExecTran(&gmopg.ExecTranArgs{
		AccessID:     entryRes.AccessID,
		AccessPass:   entryRes.AccessPass,
		OrderID:      orderID,
		Method:       gmopg.Lump,
		CardNo:       &cardNo,
		Expire:       &expire,
		SecurityCode: &securityCode,
	})

	if err != nil {
		fmt.Println(err.Error())
		return
	}

	if len(execRes.Error) > 0 {
		fmt.Println(execRes.Error)
		return
	}

	fmt.Println(execRes)
}

Bugs and Feedback

For bugs, questions and discussions please use the Github Issues.

Contribution

Contributions are always welcome.

License

MIT License

Author

koffe0522

About

Unofficial golang library for GMO Payment Gateway

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Go 99.0%
  • Makefile 1.0%