Omise Go Library
Clone or download
iporsut Merge pull request #34 from omise/fix-forgot-content-type-json
Fix wrong list charge and customer because forgot content type.
Latest commit 9a222d8 Jul 11, 2018
Permalink
Failed to load latest commit information.
internal Convert all query struct field tag to json struct field tag May 15, 2018
operations Fix wrong list charge and customer because forgot content type. Jul 11, 2018
schedule add list transfer schedules API Jun 13, 2017
testdata Support Source API and Charge by Source Dec 19, 2017
vendor/github.com dep ensure Apr 5, 2018
.gitignore Ignore .idea folder. Apr 5, 2018
.travis.yml Remove 1.6 and 1.7 from travis because support struct tag convert Dec 19, 2017
Gopkg.lock Switch from glide to godep. Apr 5, 2018
Gopkg.toml Switch from glide to godep. Apr 5, 2018
LICENSE LICENSE update. Nov 30, 2015
README.md Update README Mar 19, 2018
account.go Remove unused `pretty` tag from structs. Apr 5, 2018
balance.go Remove unused `pretty` tag from structs. Apr 5, 2018
bank_account.go Remove unused `pretty` tag from structs. Apr 5, 2018
base.go Remove unused `pretty` tag from structs. Apr 5, 2018
build.sh Perform linters after install May 14, 2018
card.go Remove unused `pretty` tag from structs. Apr 5, 2018
charge.go Add ability to create a charge with metadata May 16, 2018
charge_status.go Misc doc fixes. Mar 2, 2017
client.go Merge pull request #32 from wingyplus/remove-println Jul 10, 2018
client_test.go Fix errors resulting from the refactoring done. Apr 5, 2018
customer.go Remove unused `pretty` tag from structs. Apr 5, 2018
date.go Create Schedule operation May 16, 2017
dispute.go Update dispute with metadata May 16, 2018
dispute_status.go Misc doc fixes. Mar 2, 2017
document.go Remove unused `pretty` tag from structs. Apr 5, 2018
error.go Run the refactor tool to update error variable name convention. Apr 5, 2018
event.go Run the refactor tool to update error variable name convention. Apr 5, 2018
json_test.go Run the refactor tool to update error variable name convention. Apr 5, 2018
link.go Misc doc fixes. Mar 2, 2017
list.go Combine both list and search result generator into a single program. Mar 2, 2017
list_types.go Add get and list receipt API Aug 11, 2017
list_types.tmpl More generator improvements + limit search result types to just the s… Apr 11, 2017
occurrence.go Remove Schedule deleted field Jun 7, 2017
occurrence_status.go Schedules API May 16, 2017
offsite_types.go Alipay support. May 15, 2017
omise.go fix charge amount in document Oct 11, 2016
omise_test.go go imports. Nov 3, 2015
ordering.go Misc doc fixes. Mar 2, 2017
receipt.go Fix incorrect receipt url Aug 15, 2017
recipient.go Remove unused `pretty` tag from structs. Apr 5, 2018
recipient_type.go Misc doc fixes. Mar 2, 2017
refactor.sh Introduce a small refactoring tool to do some convention changes. Apr 5, 2018
refund.go Change Refund.Metadata type to map Jul 10, 2018
schedule.go Rename CreateSchedule to CreateChargeSchedule Jun 7, 2017
search_result.go Fix gofmt wrong file May 14, 2018
search_result_types.go Fix gofmt wrong file May 14, 2018
search_result_types.tmpl Also remove unused search result types. Apr 11, 2017
search_scope.go More generator improvements + limit search result types to just the s… Apr 11, 2017
source.go Remove unused `pretty` tag from structs. Apr 5, 2018
source_of_funds.go Misc doc fixes. Mar 2, 2017
token.go Remove unused `pretty` tag from structs. Apr 5, 2018
transaction.go Remove unused `pretty` tag from structs. Apr 5, 2018
transaction_type.go Misc doc fixes. Mar 2, 2017
transfer.go Allow merchant can create and update transfer with metadata May 16, 2018
transport.go Run the refactor tool to update error variable name convention. Apr 5, 2018
webhook.go Run the refactor tool to update error variable name convention. Apr 5, 2018

README.md

⚠️ This is not OMG, the blockchain. Visit https://omg.omise.co/ for that. ⚠️


OMISE GO CLIENT

GoDoc Build Status Omise Forum

Omise is a payment service provider currently operating in Thailand. Omise provides a set of clean APIs that helps merchants of any size accept credit cards online.

This library offers GO integration to the Omise API.

Install with:

go get github.com/omise/omise-go

COMPLIANCE WARNING

Card data should never transit through your server. This library provides means to create tokens on the server side but should only be used for testing or only if you currently have a valid PCI-DSS Attestation of Compliance (AoC) delivered by a certified QSA Auditor.

Instead we recommend that you follow our guide on how to safely collect credit information.

USAGE

See godoc.org in tandem with the Omise API Documentation for usage instruction.

Example:

package main

import (
	"log"

	"github.com/omise/omise-go"
	"github.com/omise/omise-go/operations"
)

const (
	// Read these from environment variables or configuration files!
	OmisePublicKey = "pkey_test_521w1g1t7w4x4rd22z0"
	OmiseSecretKey = "skey_test_521w1g1t6yh7sx4pu8n"
)

func main() {
	client, e := omise.NewClient(OmisePublicKey, OmiseSecretKey)
	if e != nil {
		log.Fatal(e)
	}

	// Creates a token from a test card.
	token, createToken := &omise.Token{}, &operations.CreateToken{
		Name:            "OMISE-GO Test Card",
		Number:          "4242424242424242",
		ExpirationMonth: 12,
		ExpirationYear:  2018,
	}
	if e := client.Do(token, createToken); e != nil {
		log.Fatal(e)
	}

	// Creates a charge from the token
	charge, createCharge := &omise.Charge{}, &operations.CreateCharge{
		Amount:   100000, // ฿ 1,000.00
		Currency: "thb",
		Card:     token.ID,
	}
	if e := client.Do(charge, createCharge); e != nil {
		log.Fatal(e)
	}

	log.Printf("charge: %s  amount: %s %d\n", charge.ID, charge.Currency, charge.Amount)
}

API VERSION

You can choose which API version to use with Omise. Each new API version has new features and might not be compatible with previous versions. You can change the default version by visiting your Omise Dashboard.

The version configured here will have higher priority than the version set in your Omise account. This is useful if you have multiple environments with different API versions for testing. (e.g. Development on the latest version but production is on an older version).

client.APIVersion = "2015-11-06"

It is highly recommended to set this version to the current version you're using. You can learn more about this feature in our versioning guide.

LICENSE

See LICENSE file.