Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/BoltApp/sleet
Payment abstraction library - one interface for multiple payment processors ( inspired by Ruby's ActiveMerchant )
https://github.com/BoltApp/sleet
adyen authorizenet bolt braintree cybersource payment payment-processing stripe
Last synced: about 2 months ago
JSON representation
Payment abstraction library - one interface for multiple payment processors ( inspired by Ruby's ActiveMerchant )
- Host: GitHub
- URL: https://github.com/BoltApp/sleet
- Owner: BoltApp
- License: mit
- Archived: true
- Created: 2019-11-13T21:56:58.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-29T00:14:27.000Z (10 months ago)
- Last Synced: 2024-07-30T20:43:01.991Z (5 months ago)
- Topics: adyen, authorizenet, bolt, braintree, cybersource, payment, payment-processing, stripe
- Language: Go
- Homepage:
- Size: 572 KB
- Stars: 140
- Watchers: 51
- Forks: 20
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - sleet - One unified interface for multiple Payment Service Providers (PsP) to process online payment. (Financial / Search and Analytic Databases)
- awesome-ccamel - BoltApp/sleet - Payment abstraction library - one interface for multiple payment processors ( inspired by Ruby's ActiveMerchant ) (Go)
- awesome-go-extra - sleet - one interface for multiple payment processors ( inspired by Ruby's ActiveMerchant )|98|16|8|2019-11-13T21:56:58Z|2022-08-03T18:28:58Z| (Financial / Advanced Console UIs)
README
# Sleet
[![CircleCI status](https://circleci.com/gh/BoltApp/sleet.png?circle-token=d60ceb64eb6ebdfd6a45a4703563c1752598db63 "CircleCI status")](https://circleci.com/gh/BoltApp/sleet)
[![GoDoc](https://godoc.org/github.com/BoltApp/sleet?status.svg)](https://pkg.go.dev/github.com/BoltApp/sleet?tab=doc)
[![Go Report Card](https://goreportcard.com/badge/github.com/BoltApp/sleet)](https://goreportcard.com/report/github.com/BoltApp/sleet)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 Gateway API Calls
1. Authorize
2. Capture
3. Void
4. Refund### Webhooks Support
We support abstracting PsP Webhook notifications into a common interface.
### PsP Support Matrix
| PsP | Gateway APIs | Webhooks |
|-----|--------------|----------|
| [Adyen](https://docs.adyen.com/classic-integration/api-integration-ecommerce) | ✅ | ❌ |
| [Authorize.Net](https://developer.authorize.net/api/reference/index.html#payment-transactions) | ✅ | ❌ |
| [Braintree](https://www.braintreepayments.com/) | ✅ | ❌ |
| [CyberSource](https://developer.cybersource.com/api-reference-assets/index.html#payments) | ✅ | ❌ |
| [Checkout.com](https://api-reference.checkout.com/) | ✅ | ❌ |
| [FirstData](https://docs.firstdata.com/org/gateway/docs/api) | ✅ | ❌ |
| [NMI](https://secure.networkmerchants.com/gw/merchants/resources/integration/integration_portal.php#methodology) | ✅ | ❌ |
| [Orbital](https://developer.jpmorgan.com/products/orbital-api) | ✅ | ❌ |
| [RocketGate](https://www.rocketgate.com/) | ✅ | ❌ |
| [Stripe](https://stripe.com/docs/api) | ✅ | ❌ |## 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```shell script
$ 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"
$ export CHECKOUTCOM_TEST_KEY="YOUR_CHECKOUTCOM_PRIVATE_KEY"
$ export CHECKOUTCOM_TEST_KEY_WITH_PCID="YOUR_CHECKOUTCOM_PRIVATE_KEY_WITH_PROCESSING_CHANNEL_ID"
$ export CHECKOUTCOM_TEST_PCID="YOUR_CHECKOUTCOM_PROCESSING_CHANNEL_ID"
```Then run tests with: `go test ./integration-tests/`
## Code Example for Auth + Capture
```go
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: ®ionCode,
PostalCode: &postalCode,
CountryCode: &countryCode,
}
// To get specific response headers, add them to the request options.
// They will be attached to the AuthorizationResponse
options := make(map[string]interface{})
options["ResponseHeader"] = []string{"x-test-header"}
authorizeRequest := sleet.AuthorizationRequest{
Amount: &amount,
CreditCard: &card,
BillingAddress: &address,
Options: options,
}
authorizeResponse, _ := client.Authorize(&authorizeRequest)captureRequest := sleet.CaptureRequest{
Amount: &amount,
TransactionReference: authorizeResponse.TransactionReference,
}
client.Capture(&captureRequest)
```