Installation and Configuration
How to install the prism library?
Start by installing the library from your terminal, using the programming language of your choice. This should be followed by configuring the environment and payment processor API keys to proceed with the next steps.
The below examples are templates for configuring Stripe and Adyen.
Prerequisites
- Stripe test API key (get one at stripe.com)
- Adyen test API key (get one at adyen.com/signup)
Node
npm install hyperswitch-prism
const { PaymentClient } = require('hyperswitch-prism');
// Configure Stripe client
const stripeConfig = {
connectorConfig: {
stripe: { apiKey: { value: process.env.STRIPE_API_KEY } }
}
};
const stripeClient = new PaymentClient(stripeConfig);
// Configure Adyen client
const adyenConfig = {
connectorConfig: {
adyen: {
apiKey: { value: process.env.ADYEN_API_KEY },
merchantAccount: process.env.ADYEN_MERCHANT_ACCOUNT
}
}
};
const adyenClient = new PaymentClient(adyenConfig);
Python
pip install hyperswitch-prism
import os
from orchestratorx_prism import PaymentClient
from orchestratorx_prism.generated import sdk_config_pb2
# Configure Stripe client
stripe_config = {
"connectorConfig": {
"stripe": {"apiKey": {"value": os.environ["STRIPE_API_KEY"]}}
}
}
stripe_client = PaymentClient(stripe_config)
# Configure Adyen client
adyen_config = {
"connectorConfig": {
"adyen": {
"apiKey": {"value": os.environ["ADYEN_API_KEY"]},
"merchantAccount": os.environ["ADYEN_MERCHANT_ACCOUNT"]
}
}
}
adyen_client = PaymentClient(adyen_config)
Java
<dependency>
<groupId>io.hyperswitch</groupId>
<artifactId>prism</artifactId>
<version>1.0.0</version>
</dependency>
import com.juspay.hyperswitch.prism.PaymentClient;
// Configure Stripe client
Map<String, Object> stripeConfig = new HashMap<>();
Map<String, Object> stripeConnectorConfig = new HashMap<>();
stripeConnectorConfig.put("apiKey", SecretString.of(System.getenv("STRIPE_API_KEY")));
stripeConfig.put("connectorConfig", Map.of("stripe", stripeConnectorConfig));
PaymentClient stripeClient = new PaymentClient(stripeConfig);
// Configure Adyen client
Map<String, Object> adyenConfig = new HashMap<>();
Map<String, Object> adyenConnectorConfig = new HashMap<>();
adyenConnectorConfig.put("apiKey", SecretString.of(System.getenv("ADYEN_API_KEY")));
adyenConnectorConfig.put("merchantAccount", System.getenv("ADYEN_MERCHANT_ACCOUNT"));
adyenConfig.put("connectorConfig", Map.of("adyen", adyenConnectorConfig));
PaymentClient adyenClient = new PaymentClient(adyenConfig);
PHP
composer require hyperswitch-prism
<?php
require_once 'vendor/autoload.php';
use OrchestratorXPrism\PaymentClient;
// Configure Stripe client
$stripeConfig = [
'connectorConfig' => [
'stripe' => [
'apiKey' => ['value' => $_ENV['STRIPE_API_KEY']]
]
]
];
$stripeClient = new PaymentClient($stripeConfig);
// Configure Adyen client
$adyenConfig = [
'connectorConfig' => [
'adyen' => [
'apiKey' => ['value' => $_ENV['ADYEN_API_KEY']],
'merchantAccount' => $_ENV['ADYEN_MERCHANT_ACCOUNT']
]
]
];
$adyenClient = new PaymentClient($adyenConfig);
That would be all. The SDK handles native library loading automatically. Start building in the First Payment.
Minimum version supported
The prerequisites are:
- Node.js: 16+ (FFI bindings require native compilation)
- Python: 3.9+ (uses
ctypesfor FFI) - Java: 11+ (uses JNI bindings)
- PHP: 8.0+ (uses FFI extension)