PHP SDK
🎯 What is Prism?
Today, integrating multiple payment processors either makes developers running in circles with AI agents to recreate integrations from specs, or developers spending months of engineering effort.
Because every payment processor has diverse APIs, error codes, authentication methods, pdf documents to read, and above all - different behaviour in the actual environment when compared to documented specs. All this rests as tribal or undocumented knowledge making it harder AI agents which are very good at implementing clearly documented specification.
Prism is a stateless, unified connector library for AI agents and Developers to connect with any payment processor
Prism offers hardened transformation through testing on payment processor environment & iterative bug fixing
Prism can be embedded in you server application with its wide range of multi-language SDKs, or run as a rRPC microservice
| ❌ Without Prism | ✅ With Prism |
|---|---|
| 🗂️ 100+ different API schemas | 📋 Single unified schema |
| ⏳ Never ending agent loops/ months of integration work | ⚡ Hours to integrate, Agent driven |
| 🔗 Brittle, provider-specific code | 🔓 Portable, provider-agnostic code |
| 🚫 Hard to switch providers | 🔄 Change providers in 1 line |
Installation
composer require hyperswitch/prism
Quick Start
<?php
require_once 'vendor/autoload.php';
use OrchestratorXPrism\PaymentClient;
$paymentClient = new PaymentClient([
'connector' => 'stripe',
'apiKey' => 'YOUR_API_KEY',
'environment' => 'SANDBOX'
]);
// Authorize a payment
$response = $paymentClient->authorize([
'merchantTransactionId' => 'txn_order_001',
'amount' => [
'minorAmount' => 1000,
'currency' => 'USD'
],
'paymentMethod' => [
'card' => [
'cardNumber' => ['value' => '4242424242424242'],
'cardExpMonth' => ['value' => '12'],
'cardExpYear' => ['value' => '2027'],
'cardCvc' => ['value' => '123'],
'cardHolderName' => ['value' => 'John Doe']
]
],
'authType' => 'NO_THREE_DS'
]);
echo $response['status']; // AUTHORIZED
Services
| Service | Description |
|---|---|
| Payment Service | Process payments from authorization to settlement |
| Recurring Payment Service | Manage subscriptions and recurring billing |
| Refund Service | Retrieve and track refund statuses |
| Dispute Service | Handle chargebacks and disputes |
| Event Service | Process webhook notifications |
| Payment Method Service | Store and manage payment methods |
| Customer Service | Manage customer profiles |
| Merchant Authentication Service | Generate access tokens |
| Payment Method Authentication Service | 3D Secure authentication |
| Payout Service | Send funds to recipients |
Configuration
| Option | Type | Required | Description |
|---|---|---|---|
connector | string | Yes | Payment connector name (stripe, adyen, etc.) |
apiKey | string | Yes | Your API key |
environment | string | Yes | SANDBOX or PRODUCTION |
timeout | int | No | Request timeout in seconds (default: 30) |
Error Handling
try {
$response = $paymentClient->authorize($request);
} catch (PaymentDeclinedException $e) {
// Handle declined payment
echo $e->getMessage();
} catch (ValidationException $e) {
// Handle validation error
echo $e->getErrors();
} catch (OrchestratorXException $e) {
// Handle other errors
echo $e->getMessage();
}
Support
For support and documentation, visit https://docs.orchestratorx.com