Download the PHP package keeal/keeal-php without Composer

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

Keeal PHP SDK

PHP

Official PHP client for Keeal hosted checkout: create sessions with your secret API key, redirect buyers to the returned URL, and verify webhooks.

Repository: github.com/KeealPay/keeal-php · Package: keeal/keeal-php


Overview

Keeal hosted checkout is a redirect-based payment flow:

  1. Create a session on your server with your secret API key (keeal_sk_…).
  2. Redirect the customer to the session url returned by the API.
  3. Fulfill your order when you receive a signed checkout.session.completed webhook.

Your server never handles card data. Payment UI, PayPal, and cancellation are handled on Keeal's hosted page.


Installation

Requires PHP 8.1+ with the json extension.


Configuration

Set these environment variables on your server:

Variable Description
KEEAL_API_KEY Secret API key (keeal_sk_…) from the Keeal dashboard
KEEAL_BASE_URL API base URL including /api, e.g. https://api.keeal.com/api
KEEAL_WEBHOOK_SECRET Webhook signing secret (whsec_…) from Settings → API Keys → Webhook

Use separate keys, base URLs, and webhook secrets for staging and production.

When constructing KeealCheckout, pass apiKey and baseUrl explicitly (from getenv() or your framework's config).


Quick start


API reference

KeealCheckout

Server-side client. Requires your secret API key.

Method Signature Description Status
__construct __construct(array $options) apiKey required. baseUrl required (defaults to https://api.keeal.com/api when omitted). Optional: defaultHeaders, http. Hosted
createSession createSession(array $params, array $options = []) → array{id, url} Create a checkout session. Sends Idempotency-Key (auto-generated if omitted). Hosted
createSessionUrl createSessionUrl(array $params, array $options = []) → string Convenience wrapper; returns the hosted checkout url. Hosted
listMerchantSessions listMerchantSessions(?array $options = null) → array List your checkout sessions. Options: limit, page. Hosted
retrieveMerchantSession retrieveMerchantSession(string $sessionId) → array Get one session by cs_… id, including payments[]. Hosted
retrieveSession retrieveSession(string $sessionId) → array Public session lookup (no API key sent). Hosted
createPayment createPayment(string $sessionId, array $params, array $options = []) → array Legacy custom /pay flow. Deprecated
cancelSession cancelSession(string $sessionId) → void Legacy session cancel. Deprecated
abandonSession abandonSession(string $sessionId) → void Legacy session abandon. Deprecated
paypalCreateOrder paypalCreateOrder(string $sessionId, array $params) → array Legacy PayPal create-order. Deprecated
paypalCapture paypalCapture(string $sessionId, array $params) → array Legacy PayPal capture. Deprecated

KeealCheckoutPublic

Unauthenticated client for legacy custom checkout UIs. Not recommended for new integrations.

Method Signature Description Status
__construct __construct(array $options) baseUrl required. Optional: defaultHeaders, http. Deprecated
retrieveSession retrieveSession(string $sessionId) → array Public session lookup. Deprecated
createPayment createPayment(string $sessionId, array $params, array $options = []) → array Legacy /pay from a custom UI. Deprecated
cancelSession cancelSession(string $sessionId) → void Legacy cancel. Deprecated
abandonSession abandonSession(string $sessionId) → void Legacy abandon. Deprecated
paypalCreateOrder paypalCreateOrder(string $sessionId, array $params) → array Legacy PayPal. Deprecated
paypalCapture paypalCapture(string $sessionId, array $params) → array Legacy PayPal. Deprecated

WebhookVerifier

Method / constant Signature Description
SIGNATURE_HEADER — X-Keeal-Signature
EVENT_HEADER — X-Keeal-Event
verify verify(string $rawBody, string $signatureHeader, string $whsec, int $toleranceSeconds = 300) → bool Verify signature on the raw request body.
constructEvent constructEvent(string $rawBody, string $signatureHeader, string $whsec, int $toleranceSeconds = 300) → array Verify signature and decode the JSON envelope. Throws KeealCheckoutException on failure.

Webhook verification

Configure your webhook URL in the Keeal dashboard. Verify signatures on the raw request body — do not re-encode JSON.

Signature format: t=<unix_seconds>,v1=<hex_hmac> where HMAC-SHA256 is computed over <t>.<rawBody> using your whsec_… secret.


Subscription checkout

Hosted subscription checkout follows the same pattern as Stripe Checkout for subscriptions:

  1. Create a product and price in the Keeal dashboard and copy the price id (price_…).
  2. Create a session with mode => 'subscription' and the catalog price id.
  3. Redirect to the session url.
  4. Handle checkout.session.completed and subscription webhooks.

Subscription lifecycle events (subscription.created, subscription.activated, etc.) are delivered to the same webhook URL and verified with the same signing secret as checkout events.


Legacy & deprecated APIs

These classes and methods remain for backward compatibility but are not offered to new merchants:

Symbol Use instead
KeealCheckoutPublic KeealCheckout::createSession() + redirect to url
KeealCheckout::createPayment() Redirect to session url
KeealCheckoutPublic::createPayment() Redirect to session url
cancelSession / abandonSession Handled on Keeal's hosted pay page
paypalCreateOrder / paypalCapture Handled on Keeal's hosted pay page

Laravel

Using Laravel? See keeal/laravel-checkout for a ServiceProvider, Facade, config publishing, and webhook middleware.


Development

End-to-end tests (optional)


License

MIT — see LICENSE.


All versions of keeal-php with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 keeal/keeal-php contains the following files

Loading the files please wait ...