Download the PHP package mfadul24/kount-commerce without Composer

On this page you can find all versions of the php package mfadul24/kount-commerce. 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 kount-commerce

mfadul24/kount-commerce

Sponsor

Modern, PSR-first PHP SDK for the Kount 360 Commerce APIs (Payments Fraud 2.0) — evaluate orders for fraud risk and receive a typed Approve / Decline / Review decision.

Installation

The SDK requires a PSR-18 client and PSR-17 factories at runtime (declared as virtual packages). If your project doesn't already ship one:

Any other PSR-18/PSR-17 implementation (Guzzle 7, httplug adapters, ...) works exactly the same.

Quickstart

Available operations on $kount->orders:

Method Endpoint
evaluate(OrderPostBody $body, ?bool $riskInquiry, ?bool $excludeDevice, ?bool $excludeFromPaymentsModel) POST /v2/orders
get(string $orderId) GET /v2/orders/{orderId}
update(string $orderId, OrderPatchBody $body) PATCH /v2/orders/{orderId}
batchUpdateReversals(BatchUpdateReversalsRequest $request) PATCH /v2/orders:batchUpdateReversals

Credentials

Kount issues the OAuth2 client-credentials secret in one of two shapes, and the builder has a method for each:

You were given Use Header the SDK sends
a discrete client id + client secret setOAuth($clientId, $clientSecret) Basic base64("$clientId:$clientSecret")
a single pre-encoded API key (the ready-made base64 of clientId:clientSecret) setApiKey($apiKey) Basic $apiKey — used verbatim

Some tenants — for example those onboarded via Digistore24 — never receive a separate id/secret pair, only the encoded API key. Pass it straight through; the SDK does not decode or split it:

setApiKey() behaves exactly like setOAuth() otherwise — same token endpoint, the same 401 → refresh → retry, and the same optional PSR-6 cache and tokenUrl: override:

Under the hood both route to Kount\Auth\ClientCredentialsTokenProvider, which stores only the encoded Basic credential:

Token caching (PSR-6)

Without a cache the bearer token is memoized per process only — under PHP-FPM that means one token exchange per worker. Inject any PSR-6 pool to share the token (TTL is expires_in − 60s safety skew). The example uses FilesystemAdapter, which requires composer require symfony/cache:

On a 401 the SDK invalidates the cached token, re-authenticates and retries the request exactly once; a second 401 throws AuthenticationException.

Bringing your own HTTP client

Retry and timeout policy intentionally belong to your client, not the SDK:

setRequestFactory() / setStreamFactory() accept custom PSR-17 factories; setLogger() accepts any PSR-3 logger.

Tracing outbound requests

Need per-request traceability — duration, request body, response body — for every external call the SDK makes? Decorate your PSR-18 client. Every outbound call flows through the one client you inject, so a single decorator captures both the OAuth token POST and the /v2/orders calls (tell them apart by URL). Timing and traceability policy belong to the transport layer, exactly like retries.

The SDK ships Kount\Http\SensitiveDataRedactor so your trace never records a live credential: it masks the whole Authorization header (Basic on the token call, Bearer on order calls) and any JSON body key whose name contains token (the token endpoint's access_token). Everything else — order payloads, error documents, the token request's grant_type/scope form body — is left verbatim.

Two things to keep in mind:

Sandbox

[!WARNING] The default production/sandbox hosts (https://api.kount.com/commerce, https://api-sandbox.kount.com/commerce) and the OAuth token URL are taken from the OpenAPI spec plus Kount's public documentation but have not yet been verified against live credentials. If your Kount onboarding material lists different endpoints, override them with setServerUrl() and the tokenUrl: argument of setOAuth() / useSandbox(). Running the gated live smoke test (below) settles this.

Error handling

Every exception the SDK throws implements Kount\Exception\KountException:

Exception Meaning
AuthenticationException Credentials rejected by the token endpoint, or persistent 401 after a forced refresh
TransportException The PSR-18 client failed (network, DNS, timeout) — including token endpoint calls; original exception in getPrevious()
ApiException Non-2xx API answer; carries statusCode, raw body, response and the typed error document: errorDetails (POST 400/500) or rpcStatus (all other error bodies)
MalformedResponseException 2xx answer that could not be decoded into the expected model
UnsupportedFeatureException Legacy RIS feature without a 2.0 equivalent (facade only)
InvalidArgumentException Pre-send validation (empty order id, missing credentials) — never reaches the network; extends \InvalidArgumentException

The SDK parses responses strictly against the OpenAPI contract and fails closed: an unknown enum value or a number where the spec promises a string (e.g. the uint64-as-string amount fields) raises MalformedResponseException rather than degrading silently.

Auditability

Kount's cross-system trace id arrives as the X-Correlation-Id response header and is not part of any success model. After a call, $kount->orders->lastCorrelationId() returns the header of the most recent response on that instance (null when absent). It refers to the last call only and is not concurrency-safe across a shared instance — read it right after the call whose trace you want.

Migrating from the legacy RIS SDK

Kount\Legacy\RisClient offers familiar Inquiry / Response semantics on top of the 2.0 pipeline — see docs/MIGRATION.md for the full field mapping.

Upgrading between versions of this SDK? See docs/UPGRADING.md for breaking changes and migration steps.

Legacy-only features (Khash payment encoding, masked payment tokens) throw UnsupportedFeatureException instead of silently doing nothing.

Development

The live sandbox smoke test never runs in CI; it is gated on env vars:

Optional: KOUNT_SANDBOX_SERVER_URL / KOUNT_SANDBOX_TOKEN_URL to override the unverified default endpoints.

About this codebase

The typed models were originally bootstrapped from docs/swagger.json with a code generator; the SDK is hand-maintained since and has no generator toolchain dependency. docs/swagger.json remains as the API contract reference.

Sponsoring

If this SDK saves you time, consider supporting its maintenance by sponsoring @mfadul24 on GitHub. ❤️

License

MIT


All versions of kount-commerce with dependencies

PHP Build Version
Package Version
Requires php Version >=8.3
php-http/discovery Version ^1.19
phpdocumentor/type-resolver Version ^2.0
phpstan/phpdoc-parser Version ^2.0
psr/cache Version ^2.0 || ^3.0
psr/http-client Version ^1.0
psr/http-client-implementation Version ^1.0
psr/http-factory Version ^1.0
psr/http-factory-implementation Version ^1.0
psr/http-message Version ^1.1 || ^2.0
psr/log Version ^2.0 || ^3.0
symfony/property-access Version ^6.4 || ^7.0
symfony/property-info Version ^6.4 || ^7.0
symfony/serializer Version ^6.4 || ^7.0
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 mfadul24/kount-commerce contains the following files

Loading the files please wait ...