Payment abstraction library - one interface for multiple payment processors ( inspired by Ruby's ActiveMerchant )

Sleet

CircleCI status GoDoc Go Report Card

Payment abstraction library - interact with different Payment Service Providers (PsP) with one unified interface.

Installation

go get github.com/BoltApp/sleet

Methodology

Wherever possible, we try to use native Golang implementations of the PsP's API. We also assume that the caller can pass along raw credit card information (i.e. are PCI compliant)

Supported API Calls

  1. Authorize
  2. Capture
  3. Void
  4. Refund

To run tests

Unit test

go test -v -tags=unit $(go list ./... | grep -v integration-tests)

Integration test

The following environment variables are needed in order to run tests

$ export ADYEN_USERNAME="YOUR_ADYEN_WEBSERVICE_USERNAME"
$ export ADYEN_ACCOUNT="YOUR_ADYEN_MERCHANT_ACCOUNT"
$ export ADYEN_PASSWORD="YOUR_ADYEN_WEBSERVICE_PASSWORD"
$ export STRIPE_TEST_KEY="YOUR_STRIPE_API_KEY"
$ export AUTH_NET_LOGIN_ID="YOUR_AUTHNET_LOGIN"
$ export AUTH_NET_TXN_KEY="YOUR_AUTHNET_TXN_KEY"
$ export BRAINTREE_MERCHANT_ID="YOUR_BRAINTREE_MERCHANT_ACCOUNT"
$ export BRAINTREE_PUBLIC_KEY="YOUR_BRAINTREE_PUBLIC_KEY"
$ export BRAINTREE_PRIVATE_ID="YOUR_BRAINTREE_PRIVATE_KEY"
$ export CYBERSOURCE_ACCOUNT="YOUR_CYBS_ACCOUNT"
$ export CYBERSOURCE_API_KEY="YOUR_CYBS_KEY"
$ export CYBERSOURCE_SHARED_SECRET="YOUR_CYBS_SECRET"
$ export NMI_SECURITY_KEY="YOUR_NMI_PRIVATE_KEY"

Then run tests with: go test ./integration-tests/

Code Example for Auth + Capture

import (
  "github.com/BoltApp/sleet"
  "github.com/BoltApp/sleet/gateways/authorize_net"
)
// Generate a client using your own credentials
client := authorize_net.NewClient("AUTH_NET_LOGIN_ID", "AUTH_NET_TXN_KEY")

amount := sleet.Amount{
  Amount: 100,
  Currency: "USD",
}
card := sleet.CreditCard{
  FirstName: "Bolt",
  LastName: "Checkout",
  Number: "4111111111111111",
  ExpMonth: 8,
  EpxYear: 2010,
  CVV: "000",
}
streetAddress := "22 Linda St."
locality := "Hoboken"
regionCode := "NJ"
postalCode := "07030"
countryCode := "US"
address := sleet.BillingAddress{
  StreetAddress1: &streetAddress,
  Locality:       &locality,
  RegionCode:     &regionCode,
  PostalCode:     &postalCode,
  CountryCode:    &countryCode,
}
authorizeRequest := sleet.AuthorizationRequest{
  Amount: &amount,
  CreditCard: &card,
  BillingAddress: &address,
}
authorizeResponse, _ := client.Authorize(&authorizeRequest)

captureRequest := sleet.CaptureRequest{
  Amount:               &amount,
  TransactionReference: authorizeResponse.TransactionReference,
}
client.Capture(&captureRequest)

Supported Gateways

Comments
  • Fix authnet test and enable unit test in CI

    Fix authnet test and enable unit test in CI

    As far as I can tell unit test for auth.net is completely broken. Fixed them and update circleci config to run unit tests.

    Note CI will be broken because integration test relied on secrets that are not accessible to non-Bolt employees :/

  • Add http status code to AuthorizationResponse

    Add http status code to AuthorizationResponse

    Description: this PR adds the http status code and response headers to the sleet.AuthorizationResponse struct, they will be passed back to the backend service to identify PSP internal issues.

  • Add MerchantOrderReference to Cybersource

    Add MerchantOrderReference to Cybersource

    Add MerchantOrderReference to Cybersource for Capture/Void/Refund to show Display ID corresponding to Auth request.

    Test:

    • Capture shows correct DisplayID as Authorization
    Screen Shot 2021-12-06 at 5 58 59 PM Screen Shot 2021-12-06 at 5 59 25 PM

    Related PR: https://github.com/BoltApp/source/pull/24037 (with more test pictures)

  • Fix nil pointer on cybersource transaction ID

    Fix nil pointer on cybersource transaction ID

    I know there needs to be a test for this, but the only existing test is an integration test. I'll need to come back and write a unit test for the whole file.

  • [adyen] ContAuth shopperInteraction

    [adyen] ContAuth shopperInteraction

    Add ContAuth shopper interaction to adyen credit card auth requests that will allow subsequent requests with that credit card to be authed without a cvv.

    Confirmed that this change fixes the loggedIn and recharge auth flows.

  • [Sleet] Pass Google Pay token in Adyen Auth Request

    [Sleet] Pass Google Pay token in Adyen Auth Request

    Pass Google Pay token in Adyen Gateway Auth Request.

    As documented here: https://docs.adyen.com/payment-methods/google-pay/api-only#before-you-begin.

    Ticket: https://app.asana.com/0/1200616417881435/1203366263383020/f

  • create & fulfill ClientWithContext functions

    create & fulfill ClientWithContext functions

    Creates a set of parallel methods that take a context.Context argument for all payment gateways. They all follow the same pattern of passing through X to XWithContext.

    notes:

    • Checkout.com & Rocketgate's SDK's do not allow a context variable to be supplied
    • Adyen chose an interesting way to patch context.Context onto their SDK
  • Added partial capture for checkout.com

    Added partial capture for checkout.com

    Added partial capture for checkout.com

    • updated SDK to pick up partial capture feature
    • updated usage of SDK from previous update
    • added non-final classification to all checkout.com capture requests. Final voids any remaining authorized amount. Non-final leaves the remaining amount to be voided or captured later.
  • Adding shopperIP, shopperEmail, and ShippingAddress to generic Auth Request + adding support for fields in Ayden

    Adding shopperIP, shopperEmail, and ShippingAddress to generic Auth Request + adding support for fields in Ayden

    Adding ShippingAddress to Auth request Refactoring BillingAddress type to reflect it being generic Address Supporting new fields for Ayden request (ShopperIP, ShopperEmail, ShippingAddress)

  • [Adyen Additional Info] Add Recurring Fields for Adyen

    [Adyen Additional Info] Add Recurring Fields for Adyen

    Set field ShopperReference on PaymentRequest - use ClientTransactionReference as the unique identifier. Parse the fields for recurring info - RecurringDetailReference, ShopperReference & Alias on response. Update unit tests.

  • Security Policy violation SECURITY.md

    Security Policy violation SECURITY.md

    This issue was automatically created by Allstar.

    Security Policy Violation Security policy not enabled. A SECURITY.md file can give users information about what constitutes a vulnerability and how to report one securely so that information about a bug is not publicly visible. Examples of secure reporting methods include using an issue tracker with private issue support, or encrypted email with a published key.

    To fix this, add a SECURITY.md file that explains how to handle vulnerabilities found in your repository. Go to https://github.com/BoltApp/sleet/security/policy to enable.

    For more information, see https://docs.github.com/en/code-security/getting-started/adding-a-security-policy-to-your-repository.


    This issue will auto resolve when the policy is in compliance.

    Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

  • Security Policy violation Branch Protection

    Security Policy violation Branch Protection

    This issue was automatically created by Allstar.

    Security Policy Violation Dismiss stale reviews not configured for branch master


    This issue will auto resolve when the policy is in compliance.

    Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

  • Scope and roadmap

    Scope and roadmap

    Hi!

    Thank you for building and actively maintaining this library. Before using it, I would like to know:

    • What is the scope of the library? (What features will you add? Do you plan to support recurring billing?)
    • Do you have a roadmap for webhooks / additional features?
    • Is this viable for production use?

    Thanks.

  • Adyen: Support for application information

    Adyen: Support for application information

    I would like to propose adding support for including application information scoped specifically to direct integrations. See this page for more details.

    Given that this project abstracts the direct integration approach, I propose adding support for the applicationInfo.externalPlatform request parameter for now. As a first approach, I propose sending the following JSON payload for externalPlatform:

    {
      "externalPlatform": {
        "name": "<PlatformName>",
        "version": "<LibraryVersion>",
        "integrator": "<IntegratorName>"
      }
    }
    

    Clients using this library should specify a value for each key name via environment variables. If no such value is provided, we do not send a value to Adyen.

    The benefit of addressing this issue allows merchants utilizing this library to identify themselves to Adyen as well as facilitating integration troubleshooting. Furthermore, Adyen uses this information to resolve merchant and integrator referral fees.

    I am open to further conversation about this issue and would be delighted to begin implementation if no concerns and/or objections are raised.

Go library containing a collection of financial functions for time value of money (annuities), cash flow, interest rate conversions, bonds and depreciation calculations.

go-finance Go library containing a collection of financial functions for time value of money (annuities), cash flow, interest rate conversions, bonds

Jan 2, 2023
Golang library for querying and parsing OFX

OFXGo OFXGo is a library for querying OFX servers and/or parsing the responses. It also provides an example command-line client to demonstrate the use

Jan 3, 2023
Technical Analysis Library for Golang

Techan TechAn is a technical analysis library for Go! It provides a suite of tools and frameworks to analyze financial data and make trading decisions

Dec 30, 2022
Community built data connectors and processors for Spice.ai

data-components-contrib Community built data connectors and processors for Spice.ai The vision for data-components-contrib is a community-driven libra

Sep 24, 2022
Finite-state machine with processors

FSM Finite-state machine with processors. Builder Register state processors type state1Processor struct { // clients } func NewState1Processor(..

Jan 7, 2022
Time-Based One-Time Password (TOTP) and HMAC-Based One-Time Password (HOTP) library for Go.

otpgo HMAC-Based and Time-Based One-Time Password (HOTP and TOTP) library for Go. Implements RFC 4226 and RFC 6238. Contents Supported Operations Read

Dec 19, 2022
Telego is Telegram Bot API library for Golang with full API implementation (one-to-one)
Telego is Telegram Bot API library for Golang with full API implementation (one-to-one)

Telego • Go Telegram Bot API Telego is Telegram Bot API library for Golang with full API implementation (one-to-one) The goal of this library was to c

Jan 5, 2023
This library aims to make it easier to interact with Ethereum through de Go programming language by adding a layer of abstraction through a new client on top of the go-ethereum library.

Simple ethereum client Simple ethereum client aims to make it easier for the developers to interact with Ethereum through a new layer of abstraction t

May 1, 2022
A payment server for NANO

nano-payment-server This is a server for processing NANO payments in conjunction with a node.

Mar 18, 2022
SDK for Yigim Payment Gateway

Yigim gateway SDK The package provides ability to access the Yigim payment's api via the Go language. Usage To install run: go get github.com/paladium

Oct 5, 2021
Easily encrypt data for the Adyen payment platform

adyen Encrypt secrets for the Adyen payment platform. This library uses crypto/rand to generate cryptographically secure AES keys and nonces, and re-u

Jan 2, 2023
Is a microservice which provides payment token service for application users.

Tulip Is a microservice which provides payment token service for application users. Description A transactional-based token usually used for transacti

Feb 17, 2022
Dogecoin GigaWallet is a backend service for creating payment platforms, tipping bots, dogecoin exchanges and more.
Dogecoin GigaWallet is a backend service for creating payment platforms, tipping bots, dogecoin exchanges and more.

The Dogecoin GigaWallet is a backend service which provides a convenient integration API for platforms such as online shops, exchanges, social media p

Nov 3, 2022
Golang SDK for Dusupay payment gateway API (Unofficial)

Dusupay API SDK GO (Unofficial) Description Unofficial Dusupay payment gateway API Client for Go API documentation https://docs.dusupay.com/ Installat

Sep 27, 2022
One-line-at-a-time was a hobby project inspired by the character Dwight K. Schrute of 'The Office'
One-line-at-a-time was a hobby project inspired by the character Dwight K. Schrute of 'The Office'

One Line at a Time Introduction One-line-at-a-time was a hobby project inspired by the character Dwight K. Schrute of 'The Office'. His efficient usag

Dec 13, 2021
You had one job, or more then one, which can be done in steps

Leprechaun Leprechaun is tool where you can schedule your recurring tasks to be performed over and over. In Leprechaun tasks are recipes, lets observe

Nov 23, 2022
A pair of local reverse proxies (one in Windows, one in Linux) for Tailscale on WSL2

tailscale-wsl2 TL;DR Running two reverse proxies (one in Windows, one in the WSL2 Linux VM), the Windows Tailscale daemon can be accessed via WSL2: $

Dec 9, 2022
One pg - one vakt.

pg-vakt DockerHub First, configure postgres: db: container_name: prod_db image: 'postgres:14' command: | postgres -c wal_level=replica -

Aug 25, 2022
Go (golang) wrapper for GDAL, the Geospatial Data Abstraction Library

------------- About ------------- The gdal.go package provides a go wrapper for GDAL, the Geospatial Data Abstraction Library. More information about

Dec 24, 2022
runtime - an abstraction library on top of the Open Policy Agent (OPA)

runtime - an abstraction library on top of the Open Policy Agent (OPA) Introduction The "runtime" project is a library that sits on top of OPA. The go

Nov 7, 2022