aiarmada/chip

Modern Laravel integration for CHIP payment gateway - Collect & Send APIs

Maintainers

Package info

github.com/AIArmada/chip

Homepage

Issues

pkg:composer/aiarmada/chip

Statistics

Installs: 111

Dependents: 3

Suggesters: 1

Stars: 0

v1.4.7 2025-11-13 05:31 UTC

README

Laravel 12 integration for CHIP payment platform – CHIP Collect (payments) and CHIP Send (disbursements).

Features

  • Fully independent – works standalone without requiring other commerce packages
  • Seamless integration – auto-integrates with Cart when installed together
  • Universal Gateway – implements PaymentGatewayInterface for provider switching
  • Complete API coverage – purchases, refunds, subscriptions, payouts, webhooks
  • Laravel DX – facades, fluent builders, typed data objects, events
  • Production ready – PHP 8.4, PHPStan level 6, Pest test suite
  • Secure – webhook signature verification, sensitive data masking

Installation

composer require aiarmada/chip

Publish config and migrations:

php artisan vendor:publish --tag="chip-config"
php artisan vendor:publish --tag="chip-migrations"
php artisan migrate

Configuration

# CHIP Collect
CHIP_COLLECT_API_KEY=your-api-key
CHIP_COLLECT_BRAND_ID=your-brand-id

# CHIP Send
CHIP_SEND_API_KEY=your-send-api-key
CHIP_SEND_API_SECRET=your-send-api-secret

# Environment
CHIP_ENVIRONMENT=sandbox

# Webhooks
CHIP_COMPANY_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----..."
CHIP_WEBHOOK_VERIFY_SIGNATURE=true

Quick Start

Payment Gateway (Recommended)

Works with any CheckoutableInterface – Cart, Order, or custom implementations:

use AIArmada\Chip\Gateways\ChipGateway;

$gateway = app(ChipGateway::class);
$payment = $gateway->createPayment($checkoutable, $customer, [
    'success_url' => route('checkout.success'),
    'failure_url' => route('checkout.failed'),
]);

return redirect($payment->getCheckoutUrl());

When aiarmada/cart is installed, Cart automatically implements CheckoutableInterface:

$cart = app(\AIArmada\Cart\Cart::class);
$payment = $gateway->createPayment($cart, $customer, $options);

CHIP Collect

use AIArmada\Chip\Facades\Chip;

// Create purchase
$purchase = Chip::createPurchase([
    'client' => ['email' => 'customer@example.com'],
    'purchase' => [
        'currency' => 'MYR',
        'products' => [['name' => 'Product', 'price' => 9900]],
    ],
]);

// Fluent builder
$purchase = Chip::purchase()
    ->customer('customer@example.com', 'John Doe')
    ->addProductCents('Product', 9900)
    ->successUrl(route('success'))
    ->create();

CHIP Send

use AIArmada\Chip\Facades\ChipSend;

$instruction = ChipSend::createSendInstruction(
    amountInCents: 10000,
    currency: 'MYR',
    recipientBankAccountId: 'bank_123',
    description: 'Payout',
    reference: 'PAY-001',
    email: 'recipient@example.com',
);

Webhooks

Route::post('/chip/webhook', function (Request $request) {
    $handler = app(ChipGateway::class)->getWebhookHandler();
    $payload = $handler->verify($request);
    
    if ($payload->event === 'purchase.paid') {
        // Handle payment
    }
    
    return response('OK');
});

Health Check

php artisan chip:health

Documentation

License

MIT License. See LICENSE for details.