Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
rezigned committed Aug 27, 2020
1 parent 865f518 commit 65e8143
Showing 1 changed file with 32 additions and 18 deletions.
50 changes: 32 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,25 @@ of clean APIs that helps merchants of any size accept credit cards online.

This library offers GO integration to the Omise API.

Install with:
## Installation

### Using `v1`

* [documentation][3]

```go
go get github.com/omise/omise-go
```

# COMPLIANCE WARNING
### Using `v2`

* [documentation][0]

```go
go get github.com/omise/omise-go/v2
```

## 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
Expand All @@ -30,7 +42,7 @@ Auditor.**
Instead we recommend that you follow our guide on how to safely
[collect credit information](https://www.omise.co/collecting-card-information).

# USAGE
## USAGE

See [godoc.org][0] in tandem with the [Omise API Documentation][1] for usage instruction.

Expand All @@ -42,14 +54,13 @@ package main
import (
"log"

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

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

func main() {
Expand All @@ -68,20 +79,22 @@ func main() {
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 {
charge, err := client.Charge().Create(context.Background(), &omise.CreateChargeParams{
Amount: 100000,
Currency: "THB",
Description: "initial charge.",
Card: token,
})

if err != nil {
log.Fatal(e)
}

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

# API VERSION
## 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
Expand All @@ -92,17 +105,18 @@ account. This is useful if you have multiple environments with different API ver
testing. (e.g. Development on the latest version but production is on an older version).

```
client.APIVersion = "2015-11-06"
client.APIVersion = "2019-05-29"
```

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](https://www.omise.co/api-versioning).

# LICENSE
## LICENSE

See [LICENSE][2] file.

[0]: https://godoc.org/github.com/omise/omise-go
[0]: https://godoc.org/github.com/omise/omise-go/v2
[1]: https://www.omise.co/docs
[2]: https://raw.githubusercontent.com/omise/omise-go/master/LICENSE
[3]: https://godoc.org/github.com/omise/omise-go

0 comments on commit 65e8143

Please sign in to comment.