Download the PHP package sarkhanrasimoghlu/laravel-kapital-bank-payment without Composer

On this page you can find all versions of the php package sarkhanrasimoghlu/laravel-kapital-bank-payment. 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 laravel-kapital-bank-payment

Laravel Kapital Bank Payment

A Laravel package for integrating with the Kapital Bank Checkout Merchant API V1.3. Handles payments, refunds, cancellations, OAuth2 authentication, and webhook verification out of the box.

Requirements

Installation

The service provider is auto-discovered. Publish the config and migration:

Configuration

Add these to your .env file:

Key Required Description
MERCHANT_ID Yes posDetail.merchantId
TERMINAL_ID Yes posDetail.terminalId
CLIENT_ID Yes OAuth2 client ID
CLIENT_SECRET Yes OAuth2 client secret
SECRET_KEY No Webhook HMAC secret (required only if using webhook verification)
BASE_URL Yes API base URL (must be HTTPS in production)

Optional settings:

Usage

Create a Payment

Payment Method Types

Payment with Metadata

Get Payment Status

Cancel a Payment

Cancel depends on payment status. See the payment state flow in the official documentation.

Full Refund

Partial Refund

Payment can be refunded multiple times if refundable amount is not exceeded.

Get Refund Status

Webhooks

The package automatically registers a POST /kapital-bank/callback route protected by signature verification middleware.

Webhook Payload Format

Kapital Bank sends webhooks in this format:

Supported events: payment_succeeded, payment_canceled.

Signature Verification

The middleware verifies the X-Signature header using Base64-encoded HMAC-SHA256 of the raw request body:

Requests without a valid signature are rejected.

Listening to Events

The package dispatches Laravel events that you can listen to:

Example listener:

Authentication

The package uses OAuth2 client credentials flow (POST /api/oauth2/token). Tokens are automatically:

You never need to manage tokens manually.

API Endpoints

Method Endpoint Service Method
POST /api/oauth2/token Automatic
POST /v1/payments createPayment()
GET /v1/payments/{id} getPaymentStatus()
PUT /v1/payments/{id}/cancel cancelPayment()
POST /v1/refunds refund()
GET /v1/refunds/{id} getRefundStatus()
POST /kapital-bank/callback Webhook (auto-handled)

Transaction Statuses

Enum Case Value Description
Pending pending Payment created, awaiting customer action
Succeeded succeeded Payment completed successfully
Canceled canceled Payment was canceled
WaitingForCapture waiting_for_capture Authorized, awaiting capture
Refunded refunded Fully refunded
PartiallyRefunded partially_refunded Partially refunded

Error Handling

All exceptions extend KapitalBankException which carries a getContext() method with structured error details:

Security

Database

The package creates a kapital_bank_transactions table:

Column Type Description
id bigint Primary key
transaction_id string Kapital Bank payment ID (unique)
order_id string Your application's order ID (indexed)
amount decimal(10,2) Payment amount
currency string(3) Currency code
status string Transaction status (indexed, default: pending)
payment_method string Payment method (nullable)
idempotency_key string Idempotency key (nullable)
payment_url text Redirect URL (nullable)
raw_request json Request payload (nullable)
raw_response json Response/callback payload (nullable)
paid_at timestamp When payment succeeded (nullable)
created_at timestamp Record creation time
updated_at timestamp Last update time

Testing

The package includes 86 tests covering:

Postman Collection

A ready-to-use Postman collection is included in postman/:

Features:

License

MIT


All versions of laravel-kapital-bank-payment with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version ^12.0 || ^13.0
guzzlehttp/guzzle Version ^7.8 || ^8.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 sarkhanrasimoghlu/laravel-kapital-bank-payment contains the following files

Loading the files please wait ...