Download the PHP package aghfatehi/laravel-tap without Composer

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

PHP Version Laravel Version Tap Payment Gateway License Tests Packagist Downloads

Laravel Tap Payment Gateway

Accept payments via Tap — KNET, Mada, Visa, Mastercard, Apple Pay, STC Pay, Tabby, Tamara, and more

Laravel package for integrating Tap Payments - the unified payment platform in the Middle East. Supports KNET, Mada, Visa, Mastercard, American Express, Apple Pay, Google Pay, STC Pay, Tabby, Tamara, Benefit, Fawry, OmanNet, NAPS, and more.

A professional Laravel package for integrating Tap Payments - the unified payment platform in the Middle East. Supports KNET, Mada, Visa, Mastercard, American Express, Apple Pay, Google Pay, STC Pay, Tabby, Tamara, Benefit, Fawry, OmanNet, NAPS, and more.


📋 Table of Contents


Features

Phase 1 — Payment Processing

Phase 2 — Order Management


Requirements

Laravel PHP Package Version
10.x ^8.1 ^1.0
11.x ^8.2 ^1.0
12.x ^8.2 ^1.0
13.x ^8.2 ^1.0

Installation

Publish Configuration

Publish & Run Migration (Optional but Recommended)


Configuration

Environment Variables

Add these to your .env file:

Variable Description
TAP_MERCHANT_ID Your merchant ID from Tap Dashboard (Accounts → Operators → Merchant)
TAP_SECRET_KEY Secret API key (sk_test_xxx for sandbox, sk_live_xxx for production)
TAP_PUBLIC_KEY Public API key (pk_test_xxx for sandbox, pk_live_xxx for production)
TAP_SANDBOX_MODE true for sandbox (testing), false for production
TAP_CURRENCY 3-letter ISO currency code (SAR, AED, KWD, USD, etc.)
TAP_LOCALE Checkout page language: en or ar
TAP_ROUTE_PREFIX URL prefix for all Tap routes (default: tap)

Service Provider & Facade

The package auto-discovers via Laravel's package discovery. If disabled, register manually:


🟢 Phase 1: Payment Processing (Charges)

Phase 1 covers the basic "Charge" flow — the most common integration. Customer is redirected to a Tap-hosted checkout page, pays, and returns to your app.

User Journey (Step by Step)

Routes Registered (Phase 1)

Method URI Name Description
POST /tap/pay tap.pay Initiate charge (hosted checkout)
ANY /tap/callback tap.callback Payment callback/redirect
GET /tap/cancel tap.cancel Cancel handler
GET /tap/failure tap.failure Failure handler
POST /tap/webhook tap.webhook Webhook receiver

Quick Start — Phase 1 Only

Using the Provided Routes

The simplest integration. Route your users to the checkout form:

The customer will be redirected to the Tap hosted checkout page, then back to /tap/callback after payment.

Using the Facade Directly (Custom UI)

Handling Callback (tap/callback)

When the customer completes payment on Tap's page, they are redirected back to {redirect.url} with ?tap_id=chg_xxxxxxxx. Your callback handler should:

  1. Get the tap_id from query string
  2. Call Tap::getCharge(tap_id) to verify the status
  3. Check if status is CAPTURED (success) or any other status
  4. Update your order accordingly

🔵 Phase 2: Order Management

Phase 2 adds Authorize-Capture-Void-Refund flow plus token/customer management.

Additional routes:

Method URI Name Description
POST /tap/authorize tap.authorize Create authorization
POST /tap/charge/capture tap.capture Capture authorized charge
POST /tap/charge/void tap.void Void authorized charge
POST /tap/charge/refund tap.refund Refund a charge
GET /tap/charge/{id} tap.details Get charge details

Authorize → Capture Flow

Void Flow

Refund Flow


API Methods

Phase 1: Charges

Phase 2: Authorize & Order Management

Phase 2: Tokens, Customers & Saved Cards


Webhook Handling

Tap sends server-to-server POST notifications to your webhook URL after payment events.

Webhook Payload Example

Webhook Hashstring Validation

The package automatically validates the webhook signature. Here's how it works:

The hashstring is computed as:

Custom Webhook Handler

You can listen to the dispatched events:


Integration Scenarios

Scenario A: Phase 1 Only (Minimum Integration)

You want a simple hosted checkout. No authorize/capture/refund.

  1. Add your .env variables
  2. Add a POST form to route('tap.pay') with amount
  3. Handle callback at route('tap.callback')
  4. Done.

Scenario B: Phase 1 (your own) + Phase 2 (this package)

You already have a charge integration (either via this package, another package, or direct API calls). You want to add authorize/capture/void/refund:

  1. Use Tap::createAuthorize() for auth-only payments
  2. Use Tap::captureCharge() to capture
  3. Use Tap::voidCharge() to void
  4. Use Tap::refundCharge() to refund
  5. Webhook automatically logs all events

Scenario C: Full Integration (Phase 1 + Phase 2)

All features enabled. This is the recommended approach for production.

Set up your webhook URL in your Tap Dashboard:


Routes Reference

Method URI Name Phase Description
POST /tap/pay tap.pay 1 Initiate charge (hosted checkout)
ANY /tap/callback tap.callback 1 Payment callback/redirect
GET /tap/cancel tap.cancel 1 Cancel handler
GET /tap/failure tap.failure 1 Failure handler
POST /tap/webhook tap.webhook 1+2 Webhook receiver
POST /tap/authorize tap.authorize 2 Create authorization
POST /tap/charge/capture tap.capture 2 Capture authorized charge
POST /tap/charge/void tap.void 2 Void authorized charge
POST /tap/charge/refund tap.refund 2 Refund a charge
GET /tap/charge/{id} tap.details 2 Get charge details

Customising Routes

Publish the config and modify the routes section:


Webhook Events

The package dispatches these events:

Event When Payload
PaymentSucceeded Webhook received with CAPTURED/AUTHORIZED status Full webhook payload
PaymentFailed Webhook received with failed/declined status Full webhook payload
WebhookReceived Any webhook received Payload + validation boolean

Payment Sources

The source.id field determines which payment methods appear:

Source ID Payment Methods
src_all All available methods
src_cards Card only (Visa, Mastercard, Mada)
src_kw.knet KNET only
src_sa.stcpay STC Pay only
src_bh.benefit Benefit only
src_om.omannet OmanNet only
src_qa.naps NAPS/QPay only

For a tokenized card, pass the token ID as source:


Countries & Currencies

Country Code Currency Code Decimals
Saudi Arabia SA Saudi Riyal SAR 2
UAE AE UAE Dirham AED 2
Kuwait KW Kuwaiti Dinar KWD 3
Bahrain BH Bahraini Dinar BHD 3
Qatar QA Qatari Riyal QAR 2
Oman OM Omani Riyal OMR 3
Jordan JO Jordanian Dinar JOD 3
Egypt EG Egyptian Pound EGP 2
USA US US Dollar USD 2
Europe EU Euro EUR 2
UK GB British Pound GBP 2

Security

Credential Safety

Webhook Validation

All webhooks are validated using HMAC-SHA256 hashstring verification. If the hash doesn't match, the webhook is rejected with HTTP 403.

Safe Logging


Testing

Run Package Tests

The test suite covers:

Sandbox Credentials

Set these in your .env for sandbox testing:

Note: Your API keys are provided by Tap Payments through the merchant dashboard. You can retrieve them from the Merchant Dashboard → Developers → API Keys. The keys cannot be generated or modified by the developer; they are assigned by Tap.

For viewing reports and payment transactions (both staging and production), visit: Tap Reports Portal


Test Cards — Local Payment Methods

Method Card Number Expiry PIN Result
KNET 8888880000000001 09/30 1234 CAPTURED
KNET 8888880000000002 09/30 1234 CAPTURED
KNET 8888880000000001 05/21 1234 NOT CAPTURED
Benefit 4600410123456789 12/27 1234 CAPTURED
Benefit 7777770123456789 12/27 1234 NOT CAPTURED
Benefit 1111110123456789 12/27 1234 DECLINED
Naps/QPay 4215375500883243 12/25 944 (OTP: 1234) CAPTURED

KNET Page: Select KNET Test Card [KNET1] from the Bank drop-down.


Test Cards — Credit / Debit Cards

Method Card Number 3D Secure
MasterCard 5123450000000008 Yes
MasterCard 5111111111111118 No
VISA 4508750015741019 Yes
VISA 4012000033330026 No
VISA 4440000009900010 Yes
VISA 4440000042200014 Yes
VISA 4440000042200022 Yes
American Express 345678901234564 Yes
American Express 371449635398431 No
Mada 4464040000000007 Yes
Mada 5588480000000003 No
OmanNet 4837915060379278 Yes

Expiry Date — Response Mapping

Use these expiry dates to simulate specific outcomes:

Expiry Date Transaction Response
01/39 APPROVED
05/22 DECLINED
04/27 EXPIRED_CARD
08/28 TIMED_OUT
01/37 ACQUIRER_SYSTEM_ERROR
02/37 UNSPECIFIED_FAILURE
05/37 UNKNOWN
07/30 APPROVED (OmanNet)

CSC / CVV — Response Mapping

CVV Gateway Code Meaning
100 MATCH CVV matches (MasterCard / Visa)
101 NOT_PROCESSED CVV not processed (MasterCard / Visa)
102 NO_MATCH CVV does not match (MasterCard / Visa)
1000 MATCH CVV matches (American Express)
1010 NOT_PROCESSED CVV not processed (American Express)
1020 NO_MATCH CVV does not match (American Express)
844 MATCH CVV matches (OmanNet, OTP: 9999)

STC Pay — Test Phone Numbers

Country Code Phone Number
966 548220713
966 550955806
966 554748162
966 554774102

Changelog

See CHANGELOG for recent changes.


Security

If you discover security issues, please email [email protected] instead of using the issue tracker.


License

This package is open-sourced software licensed under the MIT license.


Support


All versions of laravel-tap with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^10.0|^11.0|^12.0|^13.0
ext-curl Version *
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 aghfatehi/laravel-tap contains the following files

Loading the files please wait ...