orqex / orchestrate-php
Official PHP SDK for the Orqex payment orchestration API.
Requires
- php: ^8.3
- ext-json: *
- guzzlehttp/guzzle: ^7.5
- psr/http-client: ^1.0
- psr/http-message: ^1.1 || ^2.0
Requires (Dev)
- axazara/php-cs: ^0.4
- orchestra/testbench: ^10.0
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^10.5 || ^11.0 || ^12.0
Suggests
- illuminate/support: Enables the Laravel service provider and the Orchestrate facade (auto-discovered inside Laravel applications).
Provides
None
Conflicts
None
Replaces
None
README
Official PHP SDK for the Orqex payment orchestration API.
A single, framework-agnostic client for the Orqex merchant API: create payment intents, run hosted checkouts, attempt and confirm payments, issue refunds, requery transactions and read exchange rates. Pure PHP, with an optional Laravel integration that activates only inside Laravel applications.
- Pure PHP 8.3+ — works in any project, no framework required.
- Typed resources with IDE autocompletion, forward-compatible with new API fields.
- Guzzle by default, or bring your own HTTP client.
- Automatic retries with exponential backoff and jitter.
- Idempotency keys generated automatically for every write.
- Cursor pagination with a transparent auto-paging iterator.
- Typed exceptions mapped from HTTP status codes.
Documentation
Full documentation lives at docs.orqex.com:
| Guide | Link |
|---|---|
| Installation & configuration | https://docs.orqex.com/sdk/php/installation |
| Usage (services, resources, errors) | https://docs.orqex.com/sdk/php/usage |
| Laravel integration | https://docs.orqex.com/sdk/php/laravel |
| API reference | https://docs.orqex.com/api-reference |
| API conventions | https://docs.orqex.com/api-conventions |
Installation
composer require orqex/orchestrate-php
Requires PHP 8.3+ and ext-json. Guzzle 7.5+ is installed automatically.
Quickstart
use Orqex\Orchestrate\OrchestrateClient; $orqex = new OrchestrateClient('sk_live_xxx'); $intent = $orqex->paymentIntents()->create([ 'amount' => 50, 'currency' => 'USD', 'description' => 'Order #1024', 'customer' => [ 'email' => 'ama@example.com', 'first_name' => 'Ama', 'last_name' => 'Mensah', ], ]); echo $intent->status; // "pending" echo $intent->amount->value; // 50 (major units)
Start a payment, resolve the customer's next action, then read the final status — see the usage guide for the full flow.
Laravel
The package ships an auto-discovered service provider and Orchestrate facade. Set
ORCHESTRATE_SECRET_KEY in .env, then:
use Orqex\Orchestrate\Laravel\Facades\Orchestrate; Orchestrate::paymentIntents()->all();
See the Laravel guide.
Custom network routing
Private deployments and split-network environments may route the public API hostname to a specific address while preserving the request Host header and TLS SNI. Laravel applications can configure this without changing application code:
ORCHESTRATE_BASE_URI=https://api.orqex.com/v1 ORCHESTRATE_RESOLVE_IP=192.0.2.10 ORCHESTRATE_CA_BUNDLE=/path/to/private-ca.pem
ORCHESTRATE_RESOLVE_IP is optional and requires the PHP cURL extension. The CA
bundle is also optional; when omitted, the system trust store is used. TLS
verification remains enabled whenever these routing options are used.
Verifying webhooks
Orqex signs every webhook with the Standard Webhooks
scheme: webhook-id, webhook-timestamp and webhook-signature headers. Each webhook URL
(a pulse, or the webhook_url of a payment intent, payout or refund) has its own whsec_ secret,
shown in the Orqex dashboard. The former x-orqex-signature header is no longer sent.
Always verify the raw body exactly as received. Never decode and re-encode the JSON first: the signature covers the original bytes.
use Orqex\Orchestrate\Exception\WebhookVerificationException; use Orqex\Orchestrate\Webhook\Webhook; $webhook = new Webhook('whsec_...'); try { $event = $webhook->verify(file_get_contents('php://input'), getallheaders()); } catch (WebhookVerificationException $e) { http_response_code(400); exit; } // $event is the decoded JSON payload.
Deliveries older or newer than five minutes are rejected; pass a second argument to change
the tolerance in seconds. A PSR-7 request can be checked with $webhook->verifyRequest($request).
In Laravel:
use Illuminate\Http\Request; use Illuminate\Http\Response; use Orqex\Orchestrate\Exception\WebhookVerificationException; use Orqex\Orchestrate\Webhook\Webhook; final class OrqexWebhookController { public function __invoke(Request $request): Response { $webhook = new Webhook(config('services.orqex.payments_webhook_secret')); try { $event = $webhook->verify($request->getContent(), $request->headers->all()); } catch (WebhookVerificationException) { abort(400); } // Handle $event, ideally by dispatching a queued job keyed on webhook-id. return response()->noContent(); } }
Use $request->getContent(), not $request->all() or $request->json(), and exclude the
route from CSRF protection. Retries of the same message keep the same webhook-id: use it to
ignore duplicates.
Development
composer test # PHPUnit composer analyse # PHPStan composer sniff # php-cs-fixer (dry run) composer format # php-cs-fixer (apply)
License
Proprietary. Copyright Orqex. See LICENSE.