Ruby

Pine Labs Server SDK for Ruby.

pinelabs is the official Ruby 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.

  • Gem: pinelabs on RubyGems
  • Runtime: Ruby ≥ 3.3

Install

Ruby
# Gemfile
gem "pinelabs"
Bash
bundle install

Quickstart

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

Ruby
require "pinelabs"

base_url = "https://pluraluat.v2.pinepg.in" # UAT
# base_url = "https://api.pluralpay.in"     # Production

# 1. Get a token (the auth call itself does not need a bearer token)
auth = Pinelabs::Client.new(token: "", base_url: base_url)

token_response = auth.authentication.generate_token(
  grant_type: "client_credentials",
  client_id: ENV["PINELABS_CLIENT_ID"],
  client_secret: ENV["PINELABS_CLIENT_SECRET"]
)

# 2. Build an authenticated client
client = Pinelabs::Client.new(
  token: token_response.access_token,
  base_url: base_url
)

# 3. Call any operation
order = client.orders.create_order(
  merchant_order_reference: "order-001",
  order_amount: { value: 50_000, currency: "INR" } # ₹500.00
)

puts order

Environments

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

Pass the URL via base_url:. The default (when omitted) points to Production.

Sub-clients

Pinelabs::Client exposes one sub-client per API tag via accessor methods:

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.payment_linksSingle + bulk payment links
client.card_paymentsDirect card payment + OTP flow
client.bnplBuy-Now-Pay-Later eligibility and flows
client.convenience_feeConvenience-fee config and computation
client.e_challansGovernment e-challan integration
client.apple_payApple Pay session + decryption
client.international_paymentsCross-border (DCC / MCC) payments
client.customersCustomer profile management
client.tokenizationCard / network tokenization
client.payoutsPayouts: balance, create, cancel, list
client.subscriptions_plansRecurring-billing plans
client.subscriptions_subscriptionsSubscription lifecycle
client.subscriptions_presentationsSubscription debit presentations
client.pay_by_pointsLoyalty / points-based payments
client.affordability_suiteEMI / offer eligibility
client.split_settlementsSplit settlements between sub-merchants

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

Error handling

The SDK raises typed errors. Catch Pinelabs::Errors::ResponseError to inspect HTTP-level details:

Ruby
begin
  client.orders.get_order_by_id(order_id: "missing")
rescue Pinelabs::Errors::ResponseError => e
  puts "HTTP #{e.status_code}: #{e.body}"
rescue Pinelabs::Errors::ApiError => e
  puts "Error: #{e.message}"
end

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