PHPackages                             aiarmada/cashier-chip - 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. aiarmada/cashier-chip

ActiveLibrary

aiarmada/cashier-chip
=====================

Laravel Cashier-style billing integration for CHIP payment gateway

v1.0.0(5d ago)001MITPHP

Since Mar 18Pushed 3d agoCompare

[ Source](https://github.com/AIArmada/cashier-chip)[ Packagist](https://packagist.org/packages/aiarmada/cashier-chip)[ Docs](https://github.com/aiarmada/commerce)[ RSS](/packages/aiarmada-cashier-chip/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (1)Versions (2)Used By (1)

Laravel Cashier CHIP
====================

[](#laravel-cashier-chip)

Laravel Cashier CHIP provides an expressive, fluent interface to [CHIP](https://www.chip-in.asia/) payment services. It handles subscriptions, one-off charges, payment methods, and more, following the Laravel Cashier patterns.

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

[](#installation)

Install the package via Composer:

```
composer require aiarmada/cashier-chip
```

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

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=cashier-chip-config
```

Add the following to your `.env` file:

```
CHIP_BRAND_ID=your-brand-id
CHIP_SECRET_KEY=your-secret-key
CHIP_WEBHOOK_SECRET=your-webhook-secret
```

Run the migrations:

```
php artisan migrate
```

Billable Model
--------------

[](#billable-model)

Add the `Billable` trait to your User model:

```
use AIArmada\CashierChip\Billable;

class User extends Authenticatable
{
    use Billable;
}
```

Customer Management
-------------------

[](#customer-management)

### Creating Customers

[](#creating-customers)

```
// Create a CHIP customer
$user->createAsChipCustomer();

// Create only if not exists
$user->createAsChipCustomerIfNotExists();

// Get CHIP customer ID
$chipId = $user->chipId();

// Check if user is a CHIP customer
if ($user->hasChipId()) {
    // ...
}
```

One-off Charges
---------------

[](#one-off-charges)

### Simple Charges

[](#simple-charges)

```
// Charge the user 100.00 MYR
$payment = $user->charge(10000); // Amount in cents

// Charge with description
$payment = $user->charge(10000, [
    'reference' => 'Product Purchase',
]);
```

### Checkout Sessions

[](#checkout-sessions)

```
// Create a checkout session
$checkout = $user->checkout(10000, [
    'reference' => 'Premium Plan',
]);

return $checkout->redirect();
```

### Guest Checkout

[](#guest-checkout)

```
use AIArmada\CashierChip\Checkout;

$checkout = Checkout::guest()
    ->addProduct('Product Name', 5000, 2) // name, price in cents, quantity
    ->successUrl('/success')
    ->cancelUrl('/cancel')
    ->create(10000);

return $checkout->redirect();
```

Payment Methods (Recurring Tokens)
----------------------------------

[](#payment-methods-recurring-tokens)

```
// Get all payment methods
$paymentMethods = $user->paymentMethods();

// Get default payment method
$defaultMethod = $user->defaultPaymentMethod();

// Update default payment method
$user->updateDefaultPaymentMethod($recurringToken);

// Delete a payment method
$user->deletePaymentMethod($recurringToken);

// Check if user has payment method
if ($user->hasDefaultPaymentMethod()) {
    // ...
}
```

### Adding Payment Methods via Checkout

[](#adding-payment-methods-via-checkout)

Use zero-amount preauthorization to securely add a payment method without charging:

```
// Create a setup purchase (zero-amount preauthorization)
$checkout = $user->createSetupPurchase([
    'success_url' => route('billing.payment-methods'),
    'cancel_url' => route('billing.payment-methods'),
]);

// Redirect to CHIP checkout to collect card details
return redirect($checkout->checkout_url);

// Or use the convenience method
$url = $user->setupPaymentMethodUrl([
    'success_url' => route('billing.payment-methods'),
    'cancel_url' => route('billing.payment-methods'),
]);

return redirect($url);
```

This creates a CHIP purchase with:

- `total_override = 0` (zero amount)
- `skip_capture = true` (preauthorization only)
- `force_recurring = true` (save card for future use)

When the customer completes checkout, the webhook will automatically save the recurring token as a payment method.

Customer Billing Portal
-----------------------

[](#customer-billing-portal)

Unlike Stripe, CHIP doesn't provide a hosted billing portal. The `aiarmada/filament-chip` package provides a self-hosted Filament panel for customer billing management.

### Getting the Portal URL

[](#getting-the-portal-url)

```
use AIArmada\Cashier\Facades\Gateway;

// Get the billing portal URL via gateway
$url = Gateway::driver('chip')->customerPortalUrl(
    returnUrl: route('home'),
    options: ['panel_id' => 'billing']
);

return redirect($url);
```

See the [filament-chip documentation](../filament-chip/README.md) for full billing portal setup.

Subscriptions
-------------

[](#subscriptions)

### Creating Subscriptions

[](#creating-subscriptions)

```
// Create a subscription
$subscription = $user->newSubscription('default', 'price_monthly')
    ->create();

// With trial period
$subscription = $user->newSubscription('default', 'price_monthly')
    ->trialDays(14)
    ->create();

// With specific trial end date
$subscription = $user->newSubscription('default', 'price_monthly')
    ->trialUntil(now()->addMonth())
    ->create();

// With recurring token
$subscription = $user->newSubscription('default', 'price_monthly')
    ->create($recurringToken);

// Via checkout
$checkout = $user->newSubscription('default', 'price_monthly')
    ->checkout();

return $checkout->redirect();
```

### Checking Subscription Status

[](#checking-subscription-status)

```
if ($user->subscribed('default')) {
    // User has an active subscription...
}

if ($user->subscription('default')->valid()) {
    // Subscription is active, on trial, or on grace period...
}

if ($user->subscription('default')->onTrial()) {
    // Subscription is on trial...
}

if ($user->subscription('default')->canceled()) {
    // Subscription has been canceled...
}

if ($user->subscription('default')->onGracePeriod()) {
    // Subscription is canceled but still in grace period...
}

if ($user->subscription('default')->ended()) {
    // Subscription has completely ended...
}
```

### Subscription Management

[](#subscription-management)

```
// Cancel at end of billing period
$user->subscription('default')->cancel();

// Cancel immediately
$user->subscription('default')->cancelNow();

// Resume a canceled subscription
$user->subscription('default')->resume();

// Swap to a different price
$user->subscription('default')->swap('price_yearly');

// Change quantity
$user->subscription('default')->incrementQuantity();
$user->subscription('default')->decrementQuantity();
$user->subscription('default')->updateQuantity(10);
```

### Multiple Subscriptions

[](#multiple-subscriptions)

```
// Create different subscription types
$user->newSubscription('default', 'price_monthly')->create();
$user->newSubscription('swimming', 'price_swimming_monthly')->create();

// Check specific subscription
if ($user->subscribed('swimming')) {
    // ...
}
```

Billing Intervals
-----------------

[](#billing-intervals)

```
$subscription = $user->newSubscription('default', 'price_monthly')
    ->monthly() // or ->weekly(), ->yearly(), ->daily()
    ->create();

// Custom interval
$subscription = $user->newSubscription('default', 'price_custom')
    ->billingInterval('week', 2) // Every 2 weeks
    ->create();
```

Webhooks
--------

[](#webhooks)

The package automatically registers a webhook route at `/chip/webhook`. Configure your CHIP dashboard to send webhooks to this URL.

### Webhook Events

[](#webhook-events)

You can listen for the following events:

```
// In EventServiceProvider
use AIArmada\CashierChip\Events\PaymentSucceeded;
use AIArmada\CashierChip\Events\PaymentFailed;
use AIArmada\CashierChip\Events\SubscriptionCreated;
use AIArmada\CashierChip\Events\SubscriptionCanceled;
use AIArmada\CashierChip\Events\WebhookReceived;
use AIArmada\CashierChip\Events\WebhookHandled;

protected $listen = [
    PaymentSucceeded::class => [
        // Your listeners...
    ],
];
```

### Custom Webhook Handlers

[](#custom-webhook-handlers)

Extend the webhook controller for custom handling:

```
use AIArmada\CashierChip\Http\Controllers\WebhookController as CashierWebhookController;

class WebhookController extends CashierWebhookController
{
    protected function handlePurchasePaymentSuccess(array $payload): Response
    {
        // Your custom logic...

        return parent::handlePurchasePaymentSuccess($payload);
    }
}
```

Configuration Options
---------------------

[](#configuration-options)

```
// config/cashier-chip.php

return [
    'path' => env('CASHIER_CHIP_PATH', 'chip'),

    'currency' => env('CASHIER_CURRENCY', 'MYR'),
    'currency_locale' => env('CASHIER_CURRENCY_LOCALE', 'ms_MY'),

    'webhooks' => [
        'secret' => env('CHIP_WEBHOOK_SECRET'),
        'verify_signature' => true,
    ],

    'success_url' => env('CASHIER_CHIP_SUCCESS_URL'),
    'cancel_url' => env('CASHIER_CHIP_CANCEL_URL'),
];
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

35

—

LowBetter than 81% of packages

Maintenance99

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

5d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/726da4efcb731bc0ebcdd0b7ce64759e1f8dd63f6f771eab335458f6a2f2d3af?d=identicon)[sairiz](/maintainers/sairiz)

### Embed Badge

![Health badge](/badges/aiarmada-cashier-chip/health.svg)

```
[![Health](https://phpackages.com/badges/aiarmada-cashier-chip/health.svg)](https://phpackages.com/packages/aiarmada-cashier-chip)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
