Skip to content

lucchesisp/pagarme-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pagar.me Golang

Github All Releases API Reference Go Report Card Coverage Status License: MIT Status Badge

A Golang library to interact with Pagar.me API.

The documentation can be found in our Go Reference

Description

This library covers the following features:

[Clients]

  • Create new client
  • Edit client
  • Get client
  • Get all clients

[Cards]

  • Create card
  • Read card
  • Delete card

[Plans]

  • Create plan
  • Edit plan [Pending]
  • Delete plan [Pending]
  • Get plan [Pending]
  • Get all plans [Pending]

[Subscribe]

  • Create subscribe [Pending]
  • Create subscribe with plan
  • Edit subscribe [Pending]
  • Cancel subscribe [Pending]

How to use

go get -u github.com/lucchesisp/pagarme-go

Example: Create new client

pagarme, err := pagarme.Dial("YOUR_API_SECRET")
	
if err != nil {
  fmt.Println(err)
  return
}
	
client := types.Client{
  Code:           "#00000001",
  Name:           "Lucas Santos",
  Email:          "[email protected]",
  DocumentNumber: "12345678909",
  DocumentType:   "CPF",
  Phones: types.Phone{
    MobilePhone: types.PhoneFormat{
      CountryCode: "55",
      AreaCode:    "11",
      Number:      "988888888",
    },
    HomePhone: types.PhoneFormat{
      CountryCode: "55",
      AreaCode:    "11",
      Number:      "988888888",
    },
  },
  Birthday: time.Now(),
  Address: types.Address{
    Country: "BR",
    State:   "SP",
    City:    "São Paulo",
    Line1:   "Rua Teste",
    ZipCode: "01311000",
  },
  ClientType: "individual",
  Gender:     "male",
  Metadata:   "",
}
	
response, err := pagarme.CreateNewClient(context.Background(), &client)

if err != nil {
  fmt.Println(err)
  return
}
	
fmt.Println(response)

If you support this project, consider buying me a coffee ;)

Buy Me A Coffee

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published