mollie-api-go

module
v3.14.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2023 License: MIT

README

Mollie API Golang client

Actions

Testing Linter CodeQL

Scrutinizer CI

Build Status Code Coverage Scrutinizer Code Quality

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:

  • Get yourself a free Mollie account. No sign up costs.
  • Now you're ready to use the Mollie API client in test mode.
  • Follow a few steps to enable payment methods in live mode, and let us handle the rest.
  • Up-to-date OpenSSL (or other SSL/TLS toolkit)

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/v3/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

If you want to upgrade from v2 -> v3, the list of breaking and notable changes can be found in the docs.

⚠ Notice for v3.4 & v3.5

These versions contain breaking changes in the mollie.NewConfig method, the number of parameters increased thus breaking any previous implementation and requiring manual changes when updating.

The issue is patched for v3.6 which also includes a bunch of helper methods in the mollie.Config struct to make the usage and changes in the values more manageable.

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.

Directories

Path Synopsis
Package mollie is a wrapper around Mollie's REST API.
Package mollie is a wrapper around Mollie's REST API.
tools
package tools provides some common tools required by mollie's features in order to maximize the library utility.
package tools provides some common tools required by mollie's features in order to maximize the library utility.
tools/idempotency
package idempotency contains the services in charge of generating a unique keys to be passed in POST requests to ensure operation uniqueness.
package idempotency contains the services in charge of generating a unique keys to be passed in POST requests to ensure operation uniqueness.
tools/pagination
Package pagination provides utilities to handle pagination in API responses.
Package pagination provides utilities to handle pagination in API responses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL