Create a payment session
POST/api/payment-sessions
Creates a new payment session and returns the session details. After payment completion, a webhook will be sent to your configured endpoint. See callbacks below for more details on the webhook payload.
Request
Responses
- 200
- 201
- 400
- 403
- 422
- 503
Payment session created successfully
Payment resource created
Invalid input
Forbidden
Invalid configuration or parameters
Payment gateway unavailable
Callbacks
- POST payment.succeeded
- POST payment.failed
- POST payment.expired
- POST payment.processing
POST{$your-configured-webhook-endpoint}
[OUTGOING EVENT] Sent when a payment is successful.
[DOCUMENTATION ONLY] This webhook is sent by our system to your configured endpoint when the corresponding payment event occurs.
Security & Signature
All webhook requests include a x-OpenHive-Signature header to allow you to verify that the request was sent by OpenHive and has not been tampered with.
Signature format: t=TIMESTAMP,v1=HMAC_SHA256
How to verify:
- Extract the timestamp
tand the signaturev1from the header. - The signature is an HMAC with the SHA-256 hash function.
- It is computed using your webhook secret as the key and the JSON-encoded payload as the message.
Example implementation (PHP):
$payload = file_get_contents('php://input'); // Raw request body
$header = $_SERVER['HTTP_X_OPENHIVE_SIGNATURE']; // t=1737035345,v1=hash...
// Extract v1 from header
if (preg_match('/v1=([^,]+)/', $header, $matches)) \{
$receivedHmac = $matches[1];
\}
// Compute expected HMAC (using the same logic as OpenHive)
$expectedHmac = hash_hmac('sha256', json_encode(json_decode($payload)), $secret);
if (hash_equals($expectedHmac, $receivedHmac)) \{
// Valid signature
\}
POST{$your-configured-webhook-endpoint}
[OUTGOING EVENT] Sent when a payment fails.
[DOCUMENTATION ONLY] This webhook is sent by our system to your configured endpoint when the corresponding payment event occurs.
Security & Signature
All webhook requests include a x-OpenHive-Signature header to allow you to verify that the request was sent by OpenHive and has not been tampered with.
Signature format: t=TIMESTAMP,v1=HMAC_SHA256
How to verify:
- Extract the timestamp
tand the signaturev1from the header. - The signature is an HMAC with the SHA-256 hash function.
- It is computed using your webhook secret as the key and the JSON-encoded payload as the message.
Example implementation (PHP):
$payload = file_get_contents('php://input'); // Raw request body
$header = $_SERVER['HTTP_X_OPENHIVE_SIGNATURE']; // t=1737035345,v1=hash...
// Extract v1 from header
if (preg_match('/v1=([^,]+)/', $header, $matches)) \{
$receivedHmac = $matches[1];
\}
// Compute expected HMAC (using the same logic as OpenHive)
$expectedHmac = hash_hmac('sha256', json_encode(json_decode($payload)), $secret);
if (hash_equals($expectedHmac, $receivedHmac)) \{
// Valid signature
\}
POST{$your-configured-webhook-endpoint}
[OUTGOING EVENT] Sent when a payment session has expired.
[DOCUMENTATION ONLY] This webhook is sent by our system to your configured endpoint when the corresponding payment event occurs.
Security & Signature
All webhook requests include a x-OpenHive-Signature header to allow you to verify that the request was sent by OpenHive and has not been tampered with.
Signature format: t=TIMESTAMP,v1=HMAC_SHA256
How to verify:
- Extract the timestamp
tand the signaturev1from the header. - The signature is an HMAC with the SHA-256 hash function.
- It is computed using your webhook secret as the key and the JSON-encoded payload as the message.
Example implementation (PHP):
$payload = file_get_contents('php://input'); // Raw request body
$header = $_SERVER['HTTP_X_OPENHIVE_SIGNATURE']; // t=1737035345,v1=hash...
// Extract v1 from header
if (preg_match('/v1=([^,]+)/', $header, $matches)) \{
$receivedHmac = $matches[1];
\}
// Compute expected HMAC (using the same logic as OpenHive)
$expectedHmac = hash_hmac('sha256', json_encode(json_decode($payload)), $secret);
if (hash_equals($expectedHmac, $receivedHmac)) \{
// Valid signature
\}
POST{$your-configured-webhook-endpoint}
[OUTGOING EVENT] Sent when a payment is being processed.
[DOCUMENTATION ONLY] This webhook is sent by our system to your configured endpoint when the corresponding payment event occurs.
Security & Signature
All webhook requests include a x-OpenHive-Signature header to allow you to verify that the request was sent by OpenHive and has not been tampered with.
Signature format: t=TIMESTAMP,v1=HMAC_SHA256
How to verify:
- Extract the timestamp
tand the signaturev1from the header. - The signature is an HMAC with the SHA-256 hash function.
- It is computed using your webhook secret as the key and the JSON-encoded payload as the message.
Example implementation (PHP):
$payload = file_get_contents('php://input'); // Raw request body
$header = $_SERVER['HTTP_X_OPENHIVE_SIGNATURE']; // t=1737035345,v1=hash...
// Extract v1 from header
if (preg_match('/v1=([^,]+)/', $header, $matches)) \{
$receivedHmac = $matches[1];
\}
// Compute expected HMAC (using the same logic as OpenHive)
$expectedHmac = hash_hmac('sha256', json_encode(json_decode($payload)), $secret);
if (hash_equals($expectedHmac, $receivedHmac)) \{
// Valid signature
\}