Skip to content


Switch branches/tags

Latest commit

* add support for more payment methods

* fix comment

* feat: remove unnecessary fields

* test: add unit test

* feat: apply base fields in source model

* fix: add newline at end file

* feat: support bill payment

Co-authored-by: som-m <>

Git stats


Failed to load latest commit information.

⚠️ This is not OMG, the blockchain. Visit for that. ⚠️


GoDoc omise-go v1

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


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.


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


package main

import (


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 {

  /** Retrieve a token from a request
   * A token should be created from a client side by using our client-side libraries
   * More information:
   * -
   * -
	token := "tokn_xxxxxxxxxxxxx"

	// 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.Printf("charge: %s  amount: %s %d\n", charge.ID, charge.Currency, charge.Amount)


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.


See LICENSE file.