maytes / api-client-php
Official PHP client for the Maytes API — create, capture and cancel checkouts, with OAuth2 token management and webhook signature verification.
Requires
- php: ^8.1
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Official PHP client for the Maytes API — create, capture and cancel checkouts, and verify inbound webhook signatures.
Generated package. This repository is a build artefact, published from the Maytes API service definition. Pull requests here are not accepted — file issues instead, and fixes land upstream in the source model.
Install
composer require maytes/api-client-php
Usage
The client mints an OAuth2 client_credentials token on first use, caches it,
and — on a 401 — refreshes and retries the request once. There is no
client-side expiry maths to get wrong, and no proactive refresh to schedule.
use MaytesApiClient\ClientFactory; use MaytesApiClient\WebhookVerifier; $api = ClientFactory::create($endpoint, $clientId, $clientSecret); $checkout = $api->createCheckout($request); $event = WebhookVerifier::verify($rawBody, $signatureHeader, $signingSecret);
Verifying webhooks
Verify before parsing the body, and pass the raw request bytes — not a re-encoded object. Re-serialising changes the bytes and the signature will not match. The event id is stable across retries, so deduplicate on it.
Documentation
Full integration docs: https://developers.maytes.co
License
MIT — see LICENSE.