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-php on 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

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

Pass the URL via Configuration::setHost().

Available API classes

The SDK generates one API class per OpenAPI tag:

ClassPurpose
AuthenticationApiOAuth token generation
OrdersApiCreate, capture, cancel, and fetch orders
RefundsApiCreate and look up refunds
SettlementsApiSettlement reports + UTR lookup
CheckoutApiHosted-checkout related operations
PaymentLinksApiSingle + bulk payment links
CardPaymentsApiDirect card payment + OTP flow
BnplApiBuy-Now-Pay-Later eligibility and flows
ConvenienceFeeApiConvenience-fee config and computation
EChallansApiGovernment e-challan integration
ApplePayApiApple Pay session + decryption
InternationalPaymentsApiCross-border (DCC / MCC) payments
CustomersApiCustomer profile management
TokenizationApiCard / network tokenization
PayoutsApiPayouts: balance, create, cancel, list
SubscriptionsPlansApiRecurring-billing plans
SubscriptionsSubscriptionsApiSubscription lifecycle
SubscriptionsPresentationsApiSubscription debit presentations
PayByPointsApiLoyalty / points-based payments
AffordabilitySuiteApiEMI / offer eligibility
SplitSettlementsApiSplit 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