All Projects → luk4z7 → pagarme-go

luk4z7 / pagarme-go

Licence: BSD-3-Clause License
Pagar.me library in Go

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to pagarme-go

one
🚥 Idempotency Handler, for making sure incoming requests are idempotent. Useful for payments, "at least once delivery" systems and more.
Stars: ✭ 18 (+38.46%)
Mutual labels:  payment
nagadApi
This is Bangladeshi nagad payment gateway api development library. This library can be used in any php application.
Stars: ✭ 20 (+53.85%)
Mutual labels:  payment
paymentgateway
Dokumentace ČSOB platební brány a jejího eAPI pro platby platebními kartami, Apple Pay, mallpay a platebními tlačítky ČSOB.
Stars: ✭ 104 (+700%)
Mutual labels:  payment
pix-payload-generator.net
Gerar payload para qrcode estático PIX. (Sistema de pagamento instantâneo do Brasil) Sem a necessidade de conexão com um PSP.
Stars: ✭ 23 (+76.92%)
Mutual labels:  payment
react-native-square-reader-sdk
React Native Plugin for Square Reader SDK
Stars: ✭ 94 (+623.08%)
Mutual labels:  payment
PayumYiiExtension
Rich payment solutions for Yii framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more
Stars: ✭ 13 (+0%)
Mutual labels:  payment
midtrans-python-client
Official Midtrans Payment API Client for Python | https://midtrans.com
Stars: ✭ 24 (+84.62%)
Mutual labels:  payment
nestjs-stripe
Provides an injectable Stripe client to nestjs modules
Stars: ✭ 126 (+869.23%)
Mutual labels:  payment
frames-android
Checkout API Client, Payment Form UI and Utilities
Stars: ✭ 26 (+100%)
Mutual labels:  payment
adyen-dotnet-api-library
Adyen API Library for .NET
Stars: ✭ 69 (+430.77%)
Mutual labels:  payment
loan-payments-calculator
A small library for calculating loan payments using various configurations, works.
Stars: ✭ 13 (+0%)
Mutual labels:  payment
SwissPaymentSlip
A PHP library for creating Swiss Payment Slips
Stars: ✭ 18 (+38.46%)
Mutual labels:  payment
paydash
Worker payments dashboard for MGNREGA
Stars: ✭ 44 (+238.46%)
Mutual labels:  payment
ex pesa
Payment Library For Most Public Payment API's in Kenya and hopefully Africa. Let us get this moneybag
Stars: ✭ 19 (+46.15%)
Mutual labels:  payment
stripe-update-card
💳 Expose a page that let your customers update their payment information on Stripe.
Stars: ✭ 16 (+23.08%)
Mutual labels:  payment
crater
Open Source Invoicing Solution for Individuals & Businesses
Stars: ✭ 5,938 (+45576.92%)
Mutual labels:  payment
omise-python
Omise Python Library
Stars: ✭ 22 (+69.23%)
Mutual labels:  payment
awesome-payment
A curated list of payment services
Stars: ✭ 22 (+69.23%)
Mutual labels:  payment
youzan-pay
基于有赞云和有赞微小店实现个人收款解决方案。
Stars: ✭ 69 (+430.77%)
Mutual labels:  payment
EPAYMENT
EPayment - Multi Payment Provider for .Net Core
Stars: ✭ 43 (+230.77%)
Mutual labels:  payment

pagarme-go

Go Report Card

Installation

go get github.com/luk4z7/pagarme-go
export PAGARME_APIKEY=YOUR_APYKEY

Usage

Create a Bank:

package main

import (
	"net/url"
	"encoding/json"
	"os"
	"github.com/luk4z7/pagarme-go/auth"
	"github.com/luk4z7/pagarme-go/lib/bank"
)

var bankAccount bank.Account

func main() {
	data := []byte(`{
		"bank_code": "184",
		"agencia": "0809",
		"agencia_dv": "9",
		"conta": "08809",
		"conta_dv": "8",
		"document_number": "80802694594",
		"legal_name": "JORGER MENDES"
	}`)
	create, err, errorsApi := bankAccount.Create(data, url.Values{}, auth.Headers{})
	if err != nil {
		response, _ := json.MarshalIndent(errorsApi, "", "  ")
		os.Stdout.Write(response)
	}
	responseCreate, _ := json.MarshalIndent(create, "", " ")
	os.Stdout.Write(responseCreate)
}

Example Response

{
     "agencia": "0809",
     "agencia_dv": "9",
     "bank_code": "184",
     "conta": "08809",
     "conta_dv": "8",
     "date_created": "2016-09-14T06:45:19.395Z",
     "document_number": "80802694594",
     "document_type": "cpf",
     "id": 16740182,
     "legal_name": "JORGER MENDES",
     "object": "bank_account"
}

Create a Card:

package main

import (
	"net/url"
	"encoding/json"
	"os"
	"github.com/luk4z7/pagarme-go/auth"
	"github.com/luk4z7/pagarme-go/lib/card"
)

var creditCard card.Card

func main() {
	data2 := []byte(`{
		"card_number": "4242424242424242",
		"card_holder_name": "Marcos Mendes Teste API Create",
		"card_expiration_date": "1018"
	}`)
	create2, err, errorsApi := creditCard.Create(data2, url.Values{}, auth.Headers{})
	if err != nil {
		response, _ := json.MarshalIndent(errorsApi, "", "  ")
		os.Stdout.Write(response)
	} else {
		responseCreate2, _ := json.MarshalIndent(create2, "", " ")
		os.Stdout.Write(responseCreate2)
	}
}

Example Response

{
     "brand": "visa",
     "country": "US",
     "customer": "",
     "date_created": "2016-09-04T20:47:36.701Z",
     "date_updated": "2016-09-04T20:47:36.83Z",
     "fingerprint": "1fSoeUfMRR/V",
     "first_digits": "424242",
     "holder_name": "Marcos Mendes Teste API Create",
     "id": "card_cisp3at4s00fowm6egw1kgit1",
     "last_digits": "4242",
     "object": "card",
     "valid": true
}

Create a transaction:

package main

import (
	"encoding/json"
	"os"
	"net/url"
	"github.com/luk4z7/pagarme-go/auth"
	"github.com/luk4z7/pagarme-go/lib/transaction"
)

var transactionRecord transaction.Transaction

func main() {
	data := []byte(`{
		"amount": 100,
		"card_id": "card_cisp3at4s00fowm6egw1kgit1",
		"customer": {
			"name":"Name",
			"email":"[email protected]",
			"document_number":"80802694594",
			"gender":"M",
			"born_at":"09-22-2015",
			"address": {
				"street":"Rua de exemplo",
				"street_number":"808",
				"neighborhood":"Bairro de exemplo",
				"complementary":"Apartamento 8",
				"city":"Cidade",
				"state":"Lordaeron",
				"zipcode":"47850000",
				"country":"Lordaeron"
			},
			"phone": {
				"ddi":"88",
				"ddd":"88",
				"number":"808080808"
			}
		},
		"postback_url": "http://requestb.in/pkt7pgpk",
		"metadata": {
			"idProduto": "10"
		}
	}`)
	create, err, errorsApi := transactionRecord.Create(data, url.Values{}, auth.Headers{})
	if err != nil {
		response, _ := json.MarshalIndent(errorsApi, "", "  ")
		os.Stdout.Write(response)
	} else {
		responseCreate, _ := json.MarshalIndent(create, "", " ")
		os.Stdout.Write(responseCreate)
	}
}

For more example:

in the folder examples exist several examples how you can use, for api reference consult https://github.com/pagarme/api-reference

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].