.NET

Pine Labs Server SDK for .NET.

PinelabsApi is the official .NET 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.

  • Package: PinelabsApi on NuGet
  • Runtime: .NET 8.0 / .NET Standard 2.0 / .NET Framework 4.6.2+

Install

Bash
dotnet add package PinelabsApi

Quickstart

The Pine Labs API uses OAuth2 with the client_credentials grant. Exchange your credentials for an access token, then pass it to PinelabsApiClient.

C#
using PinelabsApi;



var baseUrl = "https://pluraluat.v2.pinepg.in"; // UAT
// var baseUrl = "https://api.pluralpay.in";     // Production



// 1. Get a token (the auth call itself does not need a bearer token)
var auth = new PinelabsApiClient(
   token: "",
   requestTimestamp: "",
   requestId: "",
   clientOptions: new ClientOptions { BaseUrl = baseUrl }
);



var tokenResponse = await auth.Authentication.GenerateTokenAsync(
   new GenerateTokenRequest
   {
       GrantType = "client_credentials",
       ClientId = Environment.GetEnvironmentVariable("PINELABS_CLIENT_ID"),
       ClientSecret = Environment.GetEnvironmentVariable("PINELABS_CLIENT_SECRET"),
   }
);



// 2. Build an authenticated client
var requestTimestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString();
var requestId = Guid.NewGuid().ToString();



var client = new PinelabsApiClient(
   token: tokenResponse.AccessToken,
   requestTimestamp: requestTimestamp,
   requestId: requestId,
   clientOptions: new ClientOptions { BaseUrl = baseUrl }
);



// 3. Call any operation
var order = await client.Orders.CreateOrderAsync(
   new CreateOrderRequest
   {
       MerchantOrderReference = "order-001",
       OrderAmount = new Amount { Value = 50000, Currency = "INR" }, // ₹500.00
   }
);



Console.WriteLine(order);

Environments

EnvironmentBase URL
UAThttps://pluraluat.v2.pinepg.in
Productionhttps://api.pluralpay.in

Pass the URL via ClientOptions.BaseUrl.

Sub-clients

PinelabsApiClient exposes one sub-client per API tag as properties:

Sub-clientPurpose
client.AuthenticationOAuth token generation
client.OrdersCreate, capture, cancel, and fetch orders
client.RefundsCreate and look up refunds
client.SettlementsSettlement reports + UTR lookup
client.CheckoutHosted-checkout related operations
client.PaymentLinksSingle + bulk payment links
client.CardPaymentsDirect card payment + OTP flow
client.BnplBuy-Now-Pay-Later eligibility and flows
client.ConvenienceFeeConvenience-fee config and computation
client.EChallansGovernment e-challan integration
client.ApplePayApple Pay session + decryption
client.InternationalPaymentsCross-border (DCC / MCC) payments
client.CustomersCustomer profile management
client.TokenizationCard / network tokenization
client.PayoutsPayouts: balance, create, cancel, list
client.SubscriptionsPlansRecurring-billing plans
client.SubscriptionsSubscriptionsSubscription lifecycle
client.SubscriptionsPresentationsSubscription debit presentations
client.PayByPointsLoyalty / points-based payments
client.AffordabilitySuiteEMI / offer eligibility
client.SplitSettlementsSplit settlements between sub-merchants

For the full operation list and request/response schemas, see the API reference.

Error handling

The SDK throws typed exceptions. Catch PinelabsApiApiException to inspect HTTP-level details:

C#
using PinelabsApi;



try
{
   var order = await client.Orders.GetOrderByIdAsync(
       new GetOrderByIdRequest { OrderId = "missing" }
   );
}
catch (PinelabsApiApiException ex)
{
   Console.Error.WriteLine($"HTTP {ex.StatusCode}: {ex.Body}");
}
catch (PinelabsApiException ex)
{
   Console.Error.WriteLine($"Error: {ex.Message}");
}

Source & support

New chat
Responses are generated using AI and may contain mistakes.
Hi! I'm Pine, your AI developer assistant. Ask me anything about Pine Labs APIs, integrations, or troubleshooting.

Tip: you can create a new chat with ⌘ + E