Quickstart
Get your first real call working with the SUQO PHP SDK.
1. Install
composer require suqo/sdk-php2. Get a sandbox key
Grab a sandbox API key (su_test_key_...) from your seller dashboard. The key's prefix tells the SDK which environment to talk to — there's nothing else to configure.
export SUQO_API_KEY='su_test_key_…'3. Make your first call
<?php
require __DIR__ . '/vendor/autoload.php';
use Suqo\SuqoClient;
$suqo = new SuqoClient(); // api key from $SUQO_API_KEY
$page = $suqo->products->list();
foreach ($page->results as $product) {
echo $product->productId, ' ', $product->name, PHP_EOL;
}new SuqoClient() makes no network request — it resolves and validates configuration, then wires the transport and the resources.
A full end-to-end flow
A real integration is rarely one isolated call. Here's the shape of a complete flow — find a billing period in your catalog, then create a subscription against it:
<?php
require __DIR__ . '/vendor/autoload.php';
use Suqo\Params\CreateSubscriptionParams;
use Suqo\Params\CustomerInput;
use Suqo\SuqoClient;
$suqo = new SuqoClient();
// 1. List products, pick a billing period to subscribe to.
$products = $suqo->products->list();
$billingPeriod = $products->results[0]?->plan[0]?->billingPeriods[0] ?? null;
if ($billingPeriod === null) {
exit("no billing period in the catalog\n");
}
// 2. Create the subscription. It comes back pending_checkout — checkoutUrl is
// where the buyer pays.
$created = $suqo->subscriptions->create(new CreateSubscriptionParams(
pbpId: $billingPeriod->pbpId,
customer: new CustomerInput(
phone: '9800000001',
fullName: 'John Doe',
email: '[email protected]',
),
returnUrl: 'https://merchant.example.com/thanks',
));
echo $created->subscriptionId, ' ', $created->status?->value, PHP_EOL;
echo $created->checkoutUrl, PHP_EOL; // send the buyer hereThe return is not proof of payment. checkoutUrl is where the buyer pays; the real outcome arrives on the checkout.succeeded / checkout.failed webhooks — see Handle webhooks.
Next
- Configure the client — keys, timeouts, retries and logging.
- Browse the catalog — where
pbpIdcomes from. - Page through results —
list()versusautoPaging().