Skip to content

SDK (unofficial) for Flow.cl Commerce API, a payment gateway for Chile and Latin America.

License

Notifications You must be signed in to change notification settings

fsandov/flow-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Client for Flow.cl Commerce API

GoDoc License

Go client (unofficial) for Flow.cl Commerce API, a payment gateway for Chile and Latin America.

Installation

go get github.com/fsandov/api-flow-go

Documentation

All the documentation of Flow API Rest can be found here

Usage

Create a client

  1. Create a client with your API key and secret key. You can get your keys here (you need to be logged in). Its recommended to use environment variables to store your keys.
  2. Create a context, you can use the context.Background() function. Also you can use the context.WithTimeout() function to set a timeout for the request.
  3. Create a struct with data to send to Flow API.

Example:

import "github.com/fsandov/api-flow-go"

func main() {
    // Create a context
    ctx := context.Background()
    // Set api key and secret key
    apiKey := ""
    secretKey := ""

    // Define data to send to Flow API
    orderData := payment.CreateOrderRequest{
        CommerceOrder:   "",
        Subject:         "",
        Currency:        "",
        Amount:          1,
        Email:           "",
        PaymentMethod:   payment.AllMethods,
        URLConfirmation: "",
        URLReturn:       "",
    }

    // Create a client with your api key and secret key
    client, err := payment.NewClient(apiKey, secretKey)
    // Send data to Flow API
    order, err := client.CreateOrder(ctx, orderData)
}

You can see more examples in the examples folder of this repository.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

About

SDK (unofficial) for Flow.cl Commerce API, a payment gateway for Chile and Latin America.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages