Download the PHP package stablevoy/stablevoy-php without Composer
On this page you can find all versions of the php package stablevoy/stablevoy-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stablevoy/stablevoy-php
More information about stablevoy/stablevoy-php
Files in stablevoy/stablevoy-php
Package stablevoy-php
Short Description PHP client for the Stablevoy API: non-custodial USDT and USDC payments, invoices and signed webhooks.
License MIT
Homepage https://stablevoy.com
Informations about the package stablevoy-php
Stablevoy PHP SDK
PHP client for Stablevoy, the non-custodial gateway for USDT and USDC payments. Customers pay on chain and the money goes straight to your own wallet: USDC and USDT on Base, Arbitrum, Optimism, Avalanche, Polygon and BNB Chain, and USDT (TRC20) on Tron with no fee.
The library creates invoices, reads them, and verifies the signed webhooks that tell your shop an order is paid. It talks to the API over ext-curl, or over any PSR-18 HTTP client you pass, and needs PHP 8.1 or newer.
Install
The library needs PSR-17 HTTP message factories. Projects with Guzzle or Symfony already have them; otherwise add composer require nyholm/psr7.
Create an invoice and send the buyer to pay
Create an API key for your store in the Stablevoy dashboard.
The buyer pays on the hosted payment page. Read an invoice at any time with $stablevoy->invoices()->get($id), or list them:
Verify webhooks
Stablevoy posts an event to your webhook URL when an invoice is paid, overpaid, underpaid, expired, paid late or put on hold. Check the signature before you trust it, using the signing secret shown when you set the webhook in the dashboard. Pass the raw body, not decoded JSON.
In Laravel the same check is $verifier->verify($request->getContent(), $request->header('X-Stablevoy-Signature', '')).
Errors and retries
Every exception implements Stablevoy\Exception\StablevoyException. API errors are ApiException with the HTTP status, a stable errorCode, a readable detail and a link to the error catalog; the ones you may want to handle on their own are AuthenticationException, ValidationException (with issues), NotFoundException, RateLimitedException and MaintenanceException. TransportException means no answer at all.
Reads, and creates that carry an idempotency key, are retried on rate limits, maintenance and failed connections, at most twice and only for waits of up to 10 seconds. Anything longer reaches you with retryAfterSeconds, so a request never hangs. Change it with ClientOptions:
Timeout
Every attempt is limited to 30 seconds, from connecting to the last byte of the answer, so a server that does not answer cannot hang your checkout. A timed-out attempt is retried where a repeat is safe, otherwise it is a TransportException. Set another limit, up to 600 seconds, as the third argument:
Your own HTTP client
Then the timeout is your client's setting. Set one: Guzzle, for example, waits forever by default (new GuzzleHttp\Client(['timeout' => 30, 'connect_timeout' => 10])).
Links
License
MIT
All versions of stablevoy-php with dependencies
ext-curl Version *
ext-json Version *
php-http/discovery Version ^1.20
psr/http-client Version ^1.0.3
psr/http-factory Version ^1.1