PHP
Pine Labs Server SDK for PHP.
pinelabs-php is the official PHP SDK for the Pine Labs Online Payment Gateway (Plural). It is generated from the OpenAPI spec using openapi-generator.
- Package:
plural-pinelabs/pinelabs-phpon Packagist - Runtime: PHP ≥ 8.1
Install
Bash
composer require plural-pinelabs/pinelabs-php
Quickstart
The Pine Labs API uses OAuth2 with the client_credentials grant. Exchange your credentials for an access token, then pass it to API calls.
PHP
<?php
require_once __DIR__ . '/vendor/autoload.php';
$baseUrl = 'https://pluraluat.v2.pinepg.in'; // UAT
// $baseUrl = 'https://api.pluralpay.in'; // Production
$config = Pinelabs\Configuration::getDefaultConfiguration()
->setHost($baseUrl);
// 1. Get a token
$authApi = new Pinelabs\Api\AuthenticationApi(
new GuzzleHttp\Client(),
$config
);
$tokenResponse = $authApi->generateToken([
'grant_type' => 'client_credentials',
'client_id' => getenv('PINELABS_CLIENT_ID'),
'client_secret' => getenv('PINELABS_CLIENT_SECRET'),
]);
// 2. Configure with the access token
$config->setAccessToken($tokenResponse->getAccessToken());
// 3. Call any operation
$ordersApi = new Pinelabs\Api\OrdersApi(
new GuzzleHttp\Client(),
$config
);
$order = $ordersApi->createOrder([
'merchant_order_reference' => 'order-001',
'order_amount' => [
'value' => 50000,
'currency' => 'INR', // ₹500.00
],
]);
print_r($order);
Environments
| Environment | Base URL |
|---|---|
| UAT | https://pluraluat.v2.pinepg.in |
| Production | https://api.pluralpay.in |
Pass the URL via Configuration::setHost().
Available API classes
The SDK generates one API class per OpenAPI tag:
| Class | Purpose |
|---|---|
AuthenticationApi | OAuth token generation |
OrdersApi | Create, capture, cancel, and fetch orders |
RefundsApi | Create and look up refunds |
SettlementsApi | Settlement reports + UTR lookup |
CheckoutApi | Hosted-checkout related operations |
PaymentLinksApi | Single + bulk payment links |
CardPaymentsApi | Direct card payment + OTP flow |
BnplApi | Buy-Now-Pay-Later eligibility and flows |
ConvenienceFeeApi | Convenience-fee config and computation |
EChallansApi | Government e-challan integration |
ApplePayApi | Apple Pay session + decryption |
InternationalPaymentsApi | Cross-border (DCC / MCC) payments |
CustomersApi | Customer profile management |
TokenizationApi | Card / network tokenization |
PayoutsApi | Payouts: balance, create, cancel, list |
SubscriptionsPlansApi | Recurring-billing plans |
SubscriptionsSubscriptionsApi | Subscription lifecycle |
SubscriptionsPresentationsApi | Subscription debit presentations |
PayByPointsApi | Loyalty / points-based payments |
AffordabilitySuiteApi | EMI / offer eligibility |
SplitSettlementsApi | Split settlements between sub-merchants |
For the full operation list and request/response schemas, see the API reference.
Error handling
API methods throw Pinelabs\ApiException on HTTP errors:
PHP
try {
$order = $ordersApi->getOrderById('missing');
} catch (Pinelabs\ApiException $e) {
echo 'HTTP ' . $e->getCode() . ': ' . $e->getResponseBody();
}
Source & support
- Packagist: plural-pinelabs/pinelabs-php
- GitHub: github.com/plural-pinelabs/pinelabs-php
- API reference: /docs/api-reference
