VictorAvelar / mollie-api-go

Golang wrapper for Mollie's REST API with full resource coverage.
https://www.mollie.com/developers/libraries/golang
MIT License
61 stars 36 forks source link
api-client golang golang-package hacktoberfest pay payment-gateway payment-processing payments

Mollie API Golang client

Actions

Testing Linter CodeQL

Go ecosystem

Go Reference Go Report Card OpenSSF Best Practices

Accepting iDEAL, Apple Pay, Bancontact, SOFORT Banking, Creditcard, SEPA Bank transfer, SEPA Direct debit, PayPal, Belfius Direct Net, KBC/CBC, paysafecard, Giftcards, Giropay, EPS and Przelewy24 online payments without fixed monthly costs or any punishing registration procedures. Just use the Mollie API to receive payments directly on your website or easily refund transactions to your customers.

Requirements

To use the Mollie API client, the following things are required:

For leveraging Mollie Connect (advanced use cases only), it is recommended to be familiar with the OAuth2 protocol.

Install

go get -u github.com/VictorAvelar/mollie-api-go/v4/mollie

Usage

Testing using API tokens

Using the config helper

// Create a configuration object with idempotency enabled.
config := mollie.NewAPITestingConfig(true)

Using the NewConfig method

// Create a configuration object with idempotency enabled.
config := mollie.NewConfig(true, mollie.ApiTokenEnv)

_ := config.ToggleIdempotency()

Testing using Organization access tokens

Using the config helper for org tokens

// Create a configuration object with idempotency enabled.
config := mollie.NewOrgTestingConfig(true)

Using the NewConfig method for org tokens

// Create a configuration object with idempotency enabled.
config := mollie.NewConfig(true, mollie.OrgTokenEnv)

_ := config.ToggleIdempotency()

Create an API client

// build your desired config
client, err := mollie.NewClient(config)
if err != nil {
    log.Fatal(err)
}
// perform operations with the API.

Upgrade guide

API parity

Checks to the API changelog are performed constantly to ensure API parity and compatibility, however it might happen that not all the changes are implemented right away.

For checking all the related tasks you can check the issues labeled with the API parity label.