Search by

orcarail / orcarail-php

amirhabibzadeh

Official PHP SDK for the OrcaRail API

Package info

github.com/OrcaRail/sdks-php

pkg:composer/orcarail/orcarail-php

Statistics

Installs: 82

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.2.1 2026-10-31 13:41 UTC

This package is auto-updated.

Last update: 2026-10-31 13:53:19 UTC


README

The official PHP 8.1+ client for the OrcaRail API. Tested on PHP 8.1–8.4.

composer require orcarail/orcarail-php
use OrcaRail\OrcaRailClient;

$orcarail = new OrcaRailClient([
    'api_key' => 'pk_live_...',
    'api_secret' => 'sk_live_...',
]);

$intent = $orcarail->paymentIntents->create([
    'price_id' => 'price_...',
    'return_url' => 'https://example.com/return',
]);

echo $intent->id;

When the customer returns to your return_url (?payment_intent=<id>), complete the intent from your backend. This is required: OrcaRail keeps a paid intent processing until it is completed, and until then the payment is not final, is never withdrawn and no payment_intent.completed webhook is sent. While the payment is still unconfirmed it returns processing; call it again later.

$intent = $orcarail->paymentIntents->complete($_GET['payment_intent']);
if ($intent->status === 'completed') {
    // fulfill the order
}

Services are exposed lazily as paymentIntents, subscriptions, pay, rates, products, and prices. API responses are OrcaRailObject values that support both property and array access.

Webhook events must be constructed from the unmodified request body:

$event = \OrcaRail\Webhook::constructEvent(
    file_get_contents('php://input'),
    $_SERVER['HTTP_X_WEBHOOK_SIGNATURE'] ?? '',
    'sk_live_...',
);

Live vs sandbox

Sandbox organizations (created with Go to sandbox in the dashboard) are testnet-only and issue ak_test_ / sk_test_ keys. Live organizations use ak_live_ / sk_live_.

// Sandbox only: complete a payment without a wallet (fires the usual webhooks)
$orcarail->paymentIntents->simulate($intent->id);

// Webhook events carry livemode: never fulfill real orders from sandbox events
if ($event->livemode === false) {
    // test event from a sandbox organization
}

Documentation

Development

composer install
composer test
composer analyse
composer cs-check