Download the PHP package epay-et/php-sdk without Composer

On this page you can find all versions of the php package epay-et/php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-sdk

epay-et/php-sdk

Official ePay Business API client for PHP, with a Laravel integration.

Accept payments from every major Ethiopian mobile wallet and bank with one integration.

Full API documentation: https://docs.epayethiopia.com/

Install

Quick start

The key prefix picks the environment: sk_test_… runs against the sandbox and sk_live_… moves real money. There is no separate mode to configure.

Configuration

Every option falls back to an environment variable, so new Epay() is enough.

Option Environment variable Default
api_key EPAY_SECRET_KEY required
webhook_secret EPAY_WEBHOOK_SECRET —
base_url EPAY_BASE_URL https://api.epayethiopia.com/v1
timeout — 30.0 seconds per attempt
max_retries — 2
default_headers — []

(string) $epay and var_dump($epay) both mask the key, so a client is safe to log.

Bring your own HTTP client

The second constructor argument takes any PSR-18 client — for connection pooling, an outbound proxy, or mTLS:

Leave http_errors off: the SDK maps non-2xx responses itself so the retry policy and error hierarchy stay in one place.

Payments

Initialize

amount, currencyCode, and customerPhone are validated locally, so a typo throws EpayValidationException immediately instead of costing a round trip.

On amounts. Pass a string. Integers and floats are accepted and rounded half-up to two places, but floats cannot represent every decimal amount exactly. The result always carries two decimal places.

On idempotency keys. If you omit idempotencyKey, the SDK generates a fresh one per call. That makes its internal retries safe — a retried initialize cannot double-charge — but it does not deduplicate across separate calls. Pass your own order id to get that guarantee.

Verify before fulfilling

The API rejects a transaction that is not yet completed, so use transactions->retrieve first if you would rather branch on status than catch an EpayBadRequestException.

Cancel

Only pending and processing transactions can be cancelled, and cancellation is irreversible. This call is never retried automatically, because the endpoint takes no idempotency key.

Transactions

Listing and pagination

The endpoint is cursor-paginated at a fixed 10 per page. Iterate a page to walk every following page, fetching lazily and carrying your filters along:

from and to accept a string or any DateTimeInterface, and the API caps the range at 90 days.

Other ways to consume the same endpoint:

Payment providers

Both endpoints are mode-aware and permission-gated: list needs list_platform_payment_provider, getAll needs get_platform_payment_provider.

Webhooks

Verify the X-Epay-Signature header against the raw request body before you trust a payload. Re-encoding a decoded array can reorder keys and change the digest, which rejects valid deliveries.

constructEvent fails closed: any event it returns had a valid signature.

Handling events

ePay retries anything that is not a 2xx within 10 seconds, up to 5 attempts, so keep the handler fast and make it idempotent — deduplicate on $event['reference'].

Laravel

The service provider is auto-discovered. Add your keys to .env:

Then inject the client anywhere:

Publish the config to change defaults:

Webhook middleware

ePay sends no CSRF token, so exclude the route and alias the middleware. In bootstrap/app.php (Laravel 11+):

On Laravel 10, add 'webhooks/epay' to $except in app/Http/Middleware/VerifyCsrfToken.php and register the alias in app/Http/Kernel.php.

Then the route:

The middleware rejects a bad or missing signature with 401 before your route runs, and VerifyEpayWebhook::event() throws rather than returning an unverified payload if the middleware was not applied.

Error handling

Every failure extends EpayException. HTTP failures carry the status, parsed body, and response headers.

Class Thrown when
EpayValidationException A value failed local validation; no request was sent
EpayConfigException The client was constructed with unusable options
EpayBadRequestException 400
EpayAuthenticationException 401 — key missing, invalid, or revoked
EpayPermissionDeniedException 403 — IP not whitelisted, or key lacks a permission
EpayNotFoundException 404
EpayConflictException 409
EpayRateLimitException 429 — exposes retryAfterSeconds()
EpayServerException 5xx
EpayTimeoutException The attempt exceeded timeout
EpayConnectionException No response was received at all
EpayWebhookSignatureException A webhook signature was missing or wrong

429, 5xx, and network errors are retried automatically before surfacing.

Sandbox testing

Use a sk_test_… key with the documented magic phone numbers:

Phone OTP Outcome
251900000000 000111 Generic sandbox account
251900000001 123456 Completes, fires payment.success
251900000002 654321 INVALID_OTP
251900000003 111111 OTP_EXPIRED
251900000004 — Declined, fires payment.failed

Generate a fresh idempotency key per test run: reusing one returns the cached response instead of triggering the scenario again.

Testing your own code

Pass a scripted PSR-18 client and no request leaves the process — see tests/ClientTest.php for a ready-made ScriptedHttpClient.

Unmodelled endpoints

$epay->request() reaches anything this version does not wrap yet, with the same auth, timeout, retry, and error handling:

Development

Releasing

CI runs the suite on PHP 8.1 through 8.4 — including a lowest dependency resolution on 8.1, so the declared minimum constraints are proven to work, not just the newest releases — plus PHPStan level 8, php-cs-fixer, and composer validate --strict.

One-time setup:

  1. Submit the repository at packagist.org/packages/submit.
  2. Enable the Packagist GitHub integration so new tags publish automatically (Packagist → your profile → Settings, or the repo's webhook settings).

Optional fallback, only if you do not set up that integration: add the repository secrets PACKAGIST_USERNAME and PACKAGIST_TOKEN. The release workflow then pings the Packagist API itself, and skips that step when the secrets are absent.

To release:

Packagist derives the version from the tag — there is no build step and nothing to upload. release.yml therefore runs the full check suite on the tag as a gate, because a published version cannot be withdrawn.

Note that Composer reads composer.json from the repository root, which is why this SDK lives in its own repository rather than a subdirectory.

License

MIT


All versions of php-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.5
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package epay-et/php-sdk contains the following files

Loading the files please wait ...