Skip to content

salihguru/papara

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Papara Go API Client

This library makes it easy to interact with the Papara API.

Supported APIs

Installation

go get github.com/9ssi7/papara

Usage

import (
	"fmt"
	"github.com/9ssi7/papara"
)

func main() {
	// Set your API key and URL
	apiKey := "YOUR_API_KEY"
	apiUrl := "YOUR_API_URL"

	// Create a new Papara client
	client := papara.New(papara.Config{
		ApiKey: apiKey,
		ApiUrl: apiUrl,
	})

	// Get account information
	account, err := client.Account()
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println("Account Information:")
	fmt.Println("  ID:", account.Data.ID)
	fmt.Println("  Balance:", account.Data.Balances[0].TotalBalance)

	// Create a payment
	payment, err := client.CreatePayment(papara.PaymentCreateRequest{
		Amount:              100.0,
		ReferenceId:         "ORDER-1234",
		OrderDescription:    "Order #1234",
		NotificationUrl:     "https://your-website.com/callback",
		FailNotificationUrl: "https://your-website.com/fail-callback",
		RedirectUrl:         "https://your-website.com/success",
	})
	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println("Payment Created:")
	fmt.Println("  ID:", payment.Data.ID)
	fmt.Println("  Payment URL:", payment.Data.PaymentUrl)
}

Contributing

If you want to contribute to this library, you are welcome to send pull requests or open issues on Github.

About

the papara rest api client for golang

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages