Welcome to the Iniciador Go SDK! This tool is made for Golang developers who want to easily integrate with our API.
If you have no idea what Iniciador is, check out our website
The Iniciador SDK is a Golang library that provides a convenient way to interact with the Iniciador API.
To install the Iniciador SDK, run the following command:
go get github.com/iniciador-de-pagamentos/iniciador-sdk-go
To use the Iniciador SDK, import the necessary modules and create an instance of the NewAuthClient
:
import (
"iniciador-sdk/iniciador/auth"
)
func main() {
clientID := "clientId"
clientSecret := "clientSecret"
environment := "dev"
authClient := auth.NewAuthClient(clientID, clientSecret, environment)
}
To authenticate with the Iniciador Whitelabel, use the AuthInterface
method:
import (
"iniciador-sdk/iniciador/auth"
)
func main() {
authOutput, err := authClient.AuthInterface()
if err != nil {
fmt.Println("Authentication failed:", err)
return
}
accessToken := authOutput.AccessToken
interfaceURL := authOutput.InterfaceURL
paymentId := authOutput.PaymentID
}
- Use interfaceURL to complete the payment flow
- Use the accessToken and paymentId to verify the payment data
To use payments services with the Iniciador Whitelabel, use the payments
method:
to get the payment details use Get
method
import (
"iniciador-sdk/iniciador/payments"
)
func main() {
payment, err := payments.Get(accessToken, authClient)
if err != nil {
fmt.Println("Get Payment failed:", err)
return
}
}
to get the payment status details use Status
method
import (
"iniciador-sdk/iniciador/payments"
)
func main() {
paymentStatus, err := payments.Status(accessToken, authClient)
if err != nil {
fmt.Println("Get Payment Status failed:", err)
return
}
}
To authenticate with the Iniciador API, use the Auth
method:
import (
"iniciador-sdk/iniciador/auth"
)
func main() {
authOutput, err := authClient.Auth()
if err != nil {
fmt.Println("Authentication failed:", err)
return
}
accessToken := authOutput.AccessToken
}
To get participants with the Iniciador API, use the GetParticipants
method:
import (
"iniciador-sdk/iniciador/participants"
)
func main() {
filters := &participants.ParticipantsFilter{}
participants, err := participants.GetParticipants(accessToken, filters, authClient)
if err != nil {
fmt.Println("Get Participants failed:", err)
return
}
}
To use payments services with the Iniciador API, use the payments
method:
to send the payment use Send
method
import (
"iniciador-sdk/iniciador/payments"
)
func main() {
paymentPayload := &payments.PaymentInitiationPayload{
ExternalID: "externalId",
ParticipantID: "c8f0bf49-4744-4933-8960-7add6e590841",
RedirectURL: "https://app.sandbox.inic.dev/pag-receipt",
User: payments.User{
Name: "John Doe",
TaxID: "taxId",
},
Amount: 133300,
Method: "PIX_MANU_AUTO",
}
paymentInitiation, err := payments.Send(accessToken, paymentPayload, authClient)
if err != nil {
fmt.Println("Send Payments failed:", err)
return
}
}
to get the payment details use Get
method
import (
"iniciador-sdk/iniciador/payments"
)
func main() {
payment, err := payments.Get(accessToken, authClient)
if err != nil {
fmt.Println("Get Payment failed:", err)
return
}
}
to get the payment status details use Status
method
import (
"iniciador-sdk/iniciador/payments"
)
func main() {
paymentStatus, err := payments.Get(accessToken, authClient)
if err != nil {
fmt.Println("Get Payment Status failed:", err)
return
}
}
If you have any questions or need assistance regarding our SDK, please don't hesitate to reach out to us. Our dedicated support team is here to help you integrate with us as quickly as possible. We strive to provide prompt responses and excellent support.
We also highly appreciate any feedback you may have. Your thoughts and suggestions are valuable to us as we continuously improve our SDK and services. We welcome your input and encourage you to share your thoughts with us.
Feel free to contact us by sending an email to suporte@iniciador.com.br. We look forward to hearing from you and assisting you with your integration.