Go
Pine Labs Server SDK for Go.
pinelabs-go is the official Go SDK for the Pine Labs Online Payment Gateway (Plural). It is generated from the same OpenAPI spec that powers this documentation, so every operation, request, and response model is fully typed.
- Module:
github.com/plural-pinelabs/pinelabs-go - Runtime: Go ≥ 1.13
Install
go get github.com/plural-pinelabs/pinelabs-go
Quickstart
The Pine Labs API uses OAuth2 with the client_credentials grant. Exchange your credentials for an access token, then pass it to client.NewClient.
package main
import (
  "context"
  "fmt"
  "os"
  pinelabs "github.com/plural-pinelabs/pinelabs-go"
  pinelabsclient "github.com/plural-pinelabs/pinelabs-go/client"
  "github.com/plural-pinelabs/pinelabs-go/option"
)
func main() {
  ctx := context.Background()
  baseURL := "https://pluraluat.v2.pinepg.in" // UAT
  // baseURL := "https://api.pluralpay.in" // Production
  // 1. Get a token (the auth call itself does not need a bearer token)
  auth := pinelabsclient.NewClient(option.WithBaseURL(baseURL))
  tokenResp, err := auth.Authentication.GenerateToken(ctx, &pinelabs.GenerateTokenRequest{
    GrantType: "client_credentials",
    ClientId: os.Getenv("PINELABS_CLIENT_ID"),
    ClientSecret: os.Getenv("PINELABS_CLIENT_SECRET"),
  })
  if err != nil {
    panic(err)
  }
  // 2. Build an authenticated client
  client := pinelabsclient.NewClient(
    option.WithBaseURL(baseURL),
    option.WithToken(tokenResp.AccessToken),
  )
  // 3. Call any operation
  order, err := client.Orders.CreateOrder(ctx, &pinelabs.CreateOrderRequest{
    MerchantOrderReference: "order-001",
    OrderAmount: &pinelabs.Amount{
      Value: pinelabs.Int(50000),
      Currency: pinelabs.String("INR"), // ₹500.00
    },
  })
  if err != nil {
    panic(err)
  }
  fmt.Println(order)
}
Environments
| Environment | Base URL |
|---|---|
| UAT | https://pluraluat.v2.pinepg.in |
| Production | https://api.pluralpay.in |
Pass the URL via option.WithBaseURL(). The exported Environments.Production constant is also available.
Sub-clients
Client exposes one sub-client per API tag. All are initialised when the client is created.
| Sub-client | Purpose |
|---|---|
client.Authentication | OAuth token generation |
client.Orders | Create, capture, cancel, and fetch orders |
client.Refunds | Create and look up refunds |
client.Settlements | Settlement reports + UTR lookup |
client.Checkout | Hosted-checkout related operations |
client.PaymentLinks | Single + bulk payment links |
client.CardPayments | Direct card payment + OTP flow |
client.Bnpl | Buy-Now-Pay-Later eligibility and flows |
client.ConvenienceFee | Convenience-fee config and computation |
client.EChallans | Government e-challan integration |
client.ApplePay | Apple Pay session + decryption |
client.InternationalPayments | Cross-border (DCC / MCC) payments |
client.Customers | Customer profile management |
client.Tokenization | Card / network tokenization |
client.Payouts | Payouts: balance, create, cancel, list |
client.SubscriptionsPlans | Recurring-billing plans |
client.SubscriptionsSubscriptions | Subscription lifecycle |
client.SubscriptionsPresentations | Subscription debit presentations |
client.PayByPoints | Loyalty / points-based payments |
client.AffordabilitySuite | EMI / offer eligibility |
client.SplitSettlements | Split settlements between sub-merchants |
For the full operation list and request/response schemas, see the API reference.
Error handling
The SDK returns errors as standard Go error values. Use type assertions to inspect HTTP-level details:
order, err := client.Orders.GetOrderById(ctx, &pinelabs.GetOrderByIdRequest{
  OrderId: "missing",
})
if err != nil {
  fmt.Fprintf(os.Stderr, "error: %v\n", err)
  return
}
Request options
Every operation accepts variadic option.RequestOption arguments for per-call overrides:
order, err := client.Orders.CreateOrder(
  ctx,
  &pinelabs.CreateOrderRequest{ /* ... */ },
  option.WithMaxAttempts(1),
)
Source & support
- GitHub: github.com/plural-pinelabs/pinelabs-go
- API reference: /docs/api-reference
