PHPackages                             el3wdy/skipcash-laravel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. el3wdy/skipcash-laravel

ActiveLibrary

el3wdy/skipcash-laravel
=======================

Production-ready Laravel package for SkipCash payment integration with first-class developer experience

02PHP

Since Sep 2Pushed 8mo agoCompare

[ Source](https://github.com/el3wdy/skipcash)[ Packagist](https://packagist.org/packages/el3wdy/skipcash-laravel)[ RSS](/packages/el3wdy-skipcash-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

SkipCash Laravel Package
========================

[](#skipcash-laravel-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2ad3b87618ddbca7299e367864afd373ee23ed770d2374ebd8ba3c15c709f4e5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c337764792f736b6970636173682d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/el3wdy/skipcash-laravel)[![GitHub Tests Action Status](https://camo.githubusercontent.com/eb31e8797a62d6895f59ebe001916482bf529c17d3a4e8af8bbe562fee875971/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f656c337764792f736b6970636173682d6c61726176656c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/el3wdy/skipcash-laravel/actions?query=workflow%3Arun-tests+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/995f462553bdd59374869a46477ca34a9222ad3b97bbb2b95f27b7de86932494/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c337764792f736b6970636173682d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/el3wdy/skipcash-laravel)

A production-ready Laravel package for SkipCash payment integration with first-class developer experience. This package provides a clean API client, secure webhook handling, events, and comprehensive test coverage for Laravel 10/11/12 (PHP 8.2+).

Features
--------

[](#features)

- 🚀 **Clean API**: Fluent, type-safe SDK for payment operations
- 🔐 **Security First**: HMAC-SHA256 signature verification for all requests
- 🎯 **Laravel Events**: Automatic event dispatching for payment status changes
- 🔄 **Webhook Handling**: Secure, idempotent webhook processing with queue support
- 📊 **Local Storage**: Optional payment records storage with Eloquent model
- 🧪 **Fully Tested**: Comprehensive test suite with 100% coverage
- 📝 **Type Safe**: Full PHP 8.2+ type declarations and PHPDoc annotations
- ⚡ **Production Ready**: Built-in retries, timeouts, and error handling

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require el3wdy/skipcash-laravel
```

Publish the configuration file:

```
php artisan vendor:publish --tag="skipcash-config"
```

Optionally, publish the migrations:

```
php artisan vendor:publish --tag="skipcash-migrations"
php artisan migrate
```

Configuration
-------------

[](#configuration)

Add the following environment variables to your `.env` file:

```
# SkipCash Environment (sandbox or production)
SKIPCASH_ENV=sandbox

# API Credentials (from SkipCash Merchant Portal > Online Payments)
SKIPCASH_KEY_ID=your-key-id
SKIPCASH_KEY_SECRET=your-key-secret
SKIPCASH_WEBHOOK_KEY=your-webhook-key

# Optional: Webhook Configuration
SKIPCASH_WEBHOOK_PATH=/skipcash/webhook
SKIPCASH_WEBHOOK_QUEUE=default

# Optional: HTTP Client Settings
SKIPCASH_TIMEOUT=10
SKIPCASH_RETRIES=3

# Optional: Local Payment Storage
SKIPCASH_STORE_PAYMENTS=true
```

### Getting Your API Credentials

[](#getting-your-api-credentials)

1. Log in to your [SkipCash Merchant Portal](https://merchant.skipcash.app)
2. Navigate to **Online Payments** section
3. Copy your `Key ID` and `Key Secret` for API authentication
4. Copy your `Webhook Key` for webhook signature verification
5. For production, ensure you're using production credentials and set `SKIPCASH_ENV=production`

Usage
-----

[](#usage)

### Creating a Payment

[](#creating-a-payment)

```
use SkipCash;

// In your controller
public function createPayment(Request $request)
{
    $payment = SkipCash::createPayment([
        // Required fields
        'Amount'     => number_format($order->total, 2, '.', ''),
        'FirstName'  => $user->first_name,
        'LastName'   => $user->last_name,
        'Phone'      => $user->phone,   // with country code (+965...)
        'Email'      => $user->email,

        // Optional fields
        'Street'     => $user->address,
        'City'       => $user->city,
        'Country'    => 'KW',
        'TransactionId' => $order->id,  // Your internal order ID
        'Custom1'    => 'any-custom-data',
    ]);

    // Redirect user to SkipCash payment page
    return redirect()->away($payment->payUrl);
}
```

### Retrieving Payment Details

[](#retrieving-payment-details)

```
$payment = SkipCash::getPayment('pay_123456789');

echo $payment->paymentId;        // 'pay_123456789'
echo $payment->amount;           // '100.00'
echo $payment->statusId;         // 2 (Paid)
echo $payment->getStatusName();  // 'Paid'

// Check payment status
if ($payment->isPaid()) {
    // Payment successful
} elseif ($payment->isFailed()) {
    // Payment failed
} elseif ($payment->isPending()) {
    // Payment pending
}
```

### Processing Refunds

[](#processing-refunds)

```
$refund = SkipCash::refund(
    paymentId: 'pay_123456789',
    amount: '50.00',
    reason: 'Customer request'
);
```

Webhook Handling
----------------

[](#webhook-handling)

The package automatically handles SkipCash webhooks and dispatches Laravel events based on payment status changes.

### Webhook Configuration

[](#webhook-configuration)

1. In your SkipCash Merchant Portal, set your webhook URL to:

    ```
    https://your-domain.com/skipcash/webhook

    ```
2. The package automatically verifies webhook signatures and processes them asynchronously via Laravel queues.

### Payment Status Events

[](#payment-status-events)

The package dispatches the following events based on `StatusId`:

StatusIdEventDescription1`PaymentPending`Payment is pending2`PaymentPaid`Payment completed successfully3`PaymentCanceled`Payment was canceled4, 5`PaymentFailed`Payment failed6`PaymentRefunded`Payment was refunded7`PaymentRefundPending`Refund is pending8`PaymentRefundFailed`Refund failed### Listening to Payment Events

[](#listening-to-payment-events)

Create event listeners to handle payment status changes:

```
// In EventServiceProvider.php
use El3wdy\Skipcash\Events\PaymentPaid;
use El3wdy\Skipcash\Events\PaymentFailed;

protected $listen = [
    PaymentPaid::class => [
        UpdateOrderStatus::class,
        SendPaymentConfirmation::class,
    ],
    PaymentFailed::class => [
        HandleFailedPayment::class,
    ],
];
```

Example listener:

```
