---
title: .NET
slug: server-sdks-dotnet
excerpt: Pine Labs Server SDK for .NET.
hidden: false
sidebar_order: 8
metadata:
  title: .NET SDK for Pine Labs Payment Gateway | NuGet Package
  description: >-
    Official .NET SDK for Pine Labs payment APIs. Integrate payment gateway with .NET 8.0, .NET Standard 2.0, or .NET Framework 4.6.2+. Fully typed client with OAuth2 authentication support.
  keywords: ".NET SDK, Pine Labs .NET, payment gateway .NET, nuget package, csharp sdk, dotnet integration, payment api"
  robots: index
---



`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`](https://www.nuget.org/packages/PinelabsApi) on NuGet
- **Runtime:** .NET 8.0 / .NET Standard 2.0 / .NET Framework 4.6.2+



## Install



<CodeTabs>
  <Tab label=".NET CLI">
   ```bash
   dotnet add package PinelabsApi
   ```
  </Tab>
  <Tab label="Package Manager">
   ```bash
   Install-Package PinelabsApi
   ```
  </Tab>
</CodeTabs>



## Quickstart



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



```csharp
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



| Environment | Base URL                            |
| ----------- | ----------------------------------- |
| UAT         | `https://pluraluat.v2.pinepg.in`    |
| Production  | `https://api.pluralpay.in`          |



Pass the URL via `ClientOptions.BaseUrl`.



## Sub-clients



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



| 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](/docs/api-reference).



## Error handling



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



```csharp
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



- NuGet: [PinelabsApi](https://www.nuget.org/packages/PinelabsApi)
- GitHub: [github.com/plural-pinelabs/pinelabs-dotnet](https://github.com/plural-pinelabs/pinelabs-dotnet)
- API reference: [/docs/api-reference](/docs/api-reference)
