Skip to main content
The BillingServ PHP SDK is the official Composer package for integrating PHP applications with the BillingServ v2 API. It provides resource clients for billing, checkout, domains, reporting, support, VPN, software licensing, and more, while handling authentication, JSON requests, response decoding, and common API errors.
The SDK is for server-side PHP applications. Never expose your merchant API key in browser code or commit it to your repository.

Requirements

  • PHP 8.3 or later
  • PHP curl extension
  • PHP json extension

Install

Install the package with Composer:
The package is released under the MIT license. See the PHP-SDK repository for the source, tests, and release history.

Configure the client

Create an API key from the API Information page, then pass the merchant bearer token to the client:
base_uri should point to your BillingServ installation and end in /api/v2, for example:
If you omit base_uri, the SDK uses the public demo API URL. Set it explicitly for production and for self-hosted BillingServ installations. The timeout option is in seconds and defaults to 30. Store configuration in environment variables or another secret store. For example:
The merchant key must have permission for the resources and operations your application calls. Keep the key on your server; customers authenticate through your application and do not need a merchant API key.

Make API calls

Resource clients are exposed as properties on the BillingServ instance. For example, list customers and create a customer with an idempotency key:
Idempotency keys are supported for the create and update operations documented in the API overview. Use a unique key for each logical write so a retry does not create a duplicate resource.

Available resources

Each SDK method maps to a documented v2 API endpoint. Use the API reference to check required fields, permissions, and response details.

Hosted checkout and domains

Create a hosted checkout URL, then redirect the customer to the returned URL:
You can also check domain availability across enabled extensions:
For the complete domain-search and callback flow, see the domain API and hosted checkout guide.

Handle errors

Successful responses are returned as plain PHP arrays. API and network failures throw exceptions:
ApiException exposes getStatus(), getErrors(), getErrorCode(), getRequestId(), and getResponse(). Record the request ID with your application logs when reporting an API failure.

Verify webhooks

When webhook signing is enabled, verify the raw request body before parsing it. The SDK checks the BillingServ-Signature header and rejects stale or invalid signatures:
Respond to verified deliveries promptly, then process them asynchronously where possible. See the webhook overview and webhook event reference for event types, retries, and endpoint configuration.

Further reading