Download the PHP package payshen/payshen-php without Composer
On this page you can find all versions of the php package payshen/payshen-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download payshen/payshen-php
More information about payshen/payshen-php
Files in payshen/payshen-php
Package payshen-php
Short Description PHP client for the Payshen payment orchestration API: payments, captures, voids, refunds, events and webhook verification.
License MIT
Homepage https://www.payshen.com/developers
Informations about the package payshen-php
Payshen PHP
The PHP client for the Payshen API: create and route payments, capture, void and refund them, read their timeline, and verify the webhooks Payshen sends.
Payshen routes each payment to one of the providers you already have (Stripe, Adyen, Checkout.com, payabl. and more). Payshen never holds or moves money: payments run on your own provider accounts.
- PHP 8.1 or newer, with
ext-curlandext-json. No other dependencies. - Every POST carries an
Idempotency-Key, so a retry after a dropped connection never charges twice. - Retries with backoff and jitter, on the answers worth retrying and never on the ones the API says not to.
- Typed exceptions with the API's own error code and the request id support will ask for.
Install
Create a payment
The customer pays on the provider's page and comes back to your return_url. The return is not the outcome:
the outcome is the webhook (payment.authorized, payment.captured, payment.declined, ...).
Capture, void, refund
A capture or void a provider only accepted answers with the payment PENDING; it becomes CAPTURED or
CANCELLED when the provider confirms, and the webhook follows.
Read
Webhooks
The signature proves a delivery came from Payshen and is recent (5 minutes by default); it does not make it new.
Webhook::claimEvent($raw, $header, $secret, $store) verifies, parses and takes each event once, with a
WebhookEventStore you back with your database:
During a secret rotation pass both secrets: Webhook::parseEvent($raw, $header, [$new, $old]).
Errors
| Exception | When |
|---|---|
AuthenticationException |
401 or 403: a missing, wrong or revoked key, or one not allowed this call |
ValidationException |
422: refused as sent; errorCode names the rule |
RateLimitException |
429 after the client's retries; retryAfterSeconds when the API said |
NetworkException |
No answer at all. On a POST, retry with the same idempotency key |
PayshenException |
Everything else, and the parent of all of the above |
Every exception has status, errorCode (refund_pending, not_capturable, payment_result_unknown, ...) and
requestId. Branch on errorCode, not on the message.
Options
$payshen->request('GET', '/api/v1/...') calls any endpoint and returns the whole answer.
Documentation
- API reference and quickstart: https://www.payshen.com/developers
- OpenAPI 3.1: https://www.payshen.com/api/v1/openapi.json
License
MIT
All versions of payshen-php with dependencies
ext-curl Version *
ext-json Version *