FlowAlp

PHP SDK

July 30, 2026

Use the FlowAlp Pay PHP SDK: Composer install, client configuration, creating and retrieving Gateways, SignatureCheck and error handling.

The PHP SDK wraps the FlowAlp Pay Merchant API: it handles authentication and signature computation and ships request/response models for Gateway, Transaction, Subscription and SignatureCheck, so you never build HTTP requests by hand.

Installation

Install via Composerbash
composer require payrexx/payrexx

The Composer package keeps the technical name of the payment infrastructure behind FlowAlp Pay — install it exactly as shown. The examples below use the FlowAlp Pay client naming; if the namespace exposed by your installed SDK version differs, keep the identical call pattern and adjust only the namespace.

Configure the client

Client setupPHP
<?php
use FlowAlpPay\FlowAlpPay;

$client = new FlowAlpPay(
    getenv('FLOWALP_TENANT'),          // instance name, e.g. demo-shop
    getenv('FLOWALP_API_SECRET'),      // API secret from the dashboard
    FlowAlpPay::DEFAULT_COMMUNICATION_HANDLER,
    'pay.flowalp.com',                 // platform domain
    '1.16'                             // recommended API version
);
PositionValueDescription
1Instance nameThe subdomain of your payment page (demo-shop for demo-shop.pay.flowalp.com) — see instance name
2API secretIssued under API & Plugins in the dashboard — see API credentials
3Communication handlerKeep the default FlowAlpPay::DEFAULT_COMMUNICATION_HANDLER
4Platform domainpay.flowalp.com — the client derives the API host api.pay.flowalp.com from it
5API version1.16 recommended; 1.14 and 1.15 remain supported

The API secret grants full access to your payment account. Load it from an environment variable or secret manager, never commit it, and never use the SDK in browser-exposed code.

Verify credentials with SignatureCheck

Connection smoke testPHP
<?php
use FlowAlpPay\Models\Request\SignatureCheck;

try {
    $client->getOne(new SignatureCheck());
    // Instance name and API secret are valid
} catch (\FlowAlpPay\FlowAlpPayException $e) {
    // Wrong instance name or API secret
}

Endpoint details are on the SignatureCheck reference page.

Create a Gateway

Create a hosted checkoutPHP
<?php
use FlowAlpPay\Models\Request\Gateway;

$gateway = new Gateway();
$gateway->setAmount(8925);            // CHF 89.25 in minor units
$gateway->setCurrency('CHF');
$gateway->setReferenceId('ORDER-975382');
$gateway->setSuccessRedirectUrl('https://merchant.example/success');
$gateway->setFailedRedirectUrl('https://merchant.example/failed');
$gateway->setCancelRedirectUrl('https://merchant.example/cancel');

$createdGateway = $client->create($gateway);

// Send the customer to the hosted payment page
$paymentPageUrl = $createdGateway->getLink();

Redirect or embed the returned payment link, and confirm the payment through webhooks — the redirect alone is not proof. All create parameters are documented in Create a Gateway.

Retrieve a Gateway

Read the current statusPHP
<?php
use FlowAlpPay\Models\Request\Gateway;

$gateway = new Gateway();
$gateway->setId(42);

$result = $client->getOne($gateway);
$status = $result->getStatus(); // e.g. waiting, confirmed, cancelled

Retrieving complements webhooks when you need an on-demand status check — see Retrieve a Gateway. The same create / getOne pattern applies to the other models, for example Transaction operations (list and retrieve, charge, capture and refund) and Subscriptions.

Handle errors

Catch SDK exceptionsPHP
<?php
use FlowAlpPay\FlowAlpPayException;

try {
    $createdGateway = $client->create($gateway);
} catch (FlowAlpPayException $e) {
    // 4xx: fix credentials, instance name or request fields - do not retry blindly
    // 5xx and rate limiting: retry with exponential backoff
    error_log('FlowAlp Pay error: ' . $e->getMessage());
}
  • Treat 4xx responses as configuration, authentication or validation problems — see errors.
  • Treat 5xx responses as transient and retry with capped exponential backoff: start at 500 ms, double per attempt, add 0–300 ms jitter, cap at 30 s, stop after 5 attempts.
  • The API allows 600 requests per 5 minutes; bursts beyond it can answer 405 and then 403 — back off in that case too. Details: rate limits.
  • Log the status code and a sanitized message with your correlation reference — never the API secret.

Conventions

  • Amounts are integers in minor units: CHF 89.25 → 8925.
  • Currencies use ISO codes such as CHF, EUR, USD.
  • referenceId carries your order ID and comes back in webhook events.

Next step: run your first API request, then wire up webhooks for reliable payment confirmation.