PHPackages                             sitehandy/omnipay-chipinasia - 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. [Payment Processing](/categories/payments)
4. /
5. sitehandy/omnipay-chipinasia

ActiveLibrary[Payment Processing](/categories/payments)

sitehandy/omnipay-chipinasia
============================

CHIP payment gateway for Omnipay - supports purchase creation, webhook verification, and transaction completion with RSA/HMAC signature validation

1.0.2(8mo ago)13MITPHPPHP ^8.0|^8.1|^8.2|^8.3|^8.4

Since Aug 18Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/sitehandy/omnipay-chipinasia)[ Packagist](https://packagist.org/packages/sitehandy/omnipay-chipinasia)[ Docs](https://github.com/sitehandy/omnipay-chipinasia)[ RSS](/packages/sitehandy-omnipay-chipinasia/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (8)Versions (4)Used By (0)

Omnipay: CHIP
=============

[](#omnipay-chip)

**CHIP payment gateway for Omnipay payment processing library with advanced webhook verification**

[![Latest Stable Version](https://camo.githubusercontent.com/30b7eeaa92063330ab26446c8d6cb2dc56197b3989006d95b2cbbde576099b2f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7369746568616e64792f6f6d6e697061792d63686970696e617369612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sitehandy/omnipay-chipinasia)[![Total Downloads](https://camo.githubusercontent.com/c1621e9c7ae86b601c6f986e8187c4d1a86ea866578c7bacb674161b70205115/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7369746568616e64792f6f6d6e697061792d63686970696e617369612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sitehandy/omnipay-chipinasia)[![License](https://camo.githubusercontent.com/9ca820ce11e83a726cbed215170d4d64b866a87e157c1fbb22ce6940382fc9ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7369746568616e64792f6f6d6e697061792d63686970696e617369612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sitehandy/omnipay-chipinasia)

[Omnipay](https://github.com/thephpleague/omnipay) is a framework agnostic, multi-gateway payment processing library for PHP. This package implements CHIP payment gateway support for Omnipay with comprehensive webhook verification including both HMAC and RSA signature validation.

Features
--------

[](#features)

- ✅ **Dual Signature Verification**: Support for both HMAC (webhook secret) and RSA (public key) signature verification
- ✅ **Multi-Currency Support**: MYR, SGD, USD, THB, VND, IDR
- ✅ **Advanced Purchase Options**: Due dates, timezones, creator agents, and custom metadata
- ✅ **Comprehensive Error Handling**: Detailed error messages and proper exception handling
- ✅ **Modern PHP Support**: PHP 8.0-8.4 with strict typing and modern practices
- ✅ **Extensive Testing**: 56 tests with 111 assertions covering all functionality
- ✅ **Laravel Integration**: Ready-to-use examples for Laravel applications

Requirements
------------

[](#requirements)

- PHP 8.0 or higher (8.0, 8.1, 8.2, 8.3, 8.4 supported)
- cURL extension
- JSON extension
- OpenSSL extension (for RSA signature verification)
- Omnipay 3.x

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

[](#installation)

Omnipay is installed via Composer. To install, simply require league/omnipay and sitehandy/omnipay-chipinasia with Composer:

```
composer require league/omnipay sitehandy/omnipay-chipinasia
```

**Note:** Composer will automatically select the latest stable version. If you need a specific version, you can specify it, but using version constraints like ^1.0 may cause warnings.

### Version Information

[](#version-information)

- **v2.0.0**: Enhanced release with dual signature verification (HMAC + RSA), expanded currency support, and modern PHP 8.0+ features
- **Requirements**: PHP 8.0+ with cURL, JSON, and OpenSSL extensions
- **Compatibility**: Omnipay 3.x framework with comprehensive webhook verification

Table of Contents
-----------------

[](#table-of-contents)

- [Basic Usage](#basic-usage)
- [Quick Start](#quick-start)
- [Advanced Configuration](#advanced-configuration)
- [Error Handling](#error-handling)
- [Testing](#testing)
- [Security Best Practices](#security-best-practices)
- [Troubleshooting](#troubleshooting)
- [API Reference](#api-reference)
- [Laravel Integration](#laravel-integration)
- [Webhooks](#webhooks)
- [Contributing](#contributing)
- [Support](#support)

Basic Usage
-----------

[](#basic-usage)

For general usage instructions, please see the main [Omnipay repository](https://github.com/thephpleague/omnipay).

### CHIP Account Setup

[](#chip-account-setup)

To begin, you need to:

1. Open an account at [CHIP](https://www.chip-in.asia)
2. Obtain your API credentials (API Key and Brand ID)
3. Configure your webhook endpoints with either:
    - **Webhook Secret** for HMAC-SHA256 verification (recommended for most use cases)
    - **Public Key** for RSA-SHA256 verification (enhanced security)
4. Set up your return URLs for different payment outcomes

Quick Start
-----------

[](#quick-start)

```
use Omnipay\Omnipay;

// Initialize the gateway
$gateway = Omnipay::create('ChipInAsia');
$gateway->setApiKey('your_api_key_here');
$gateway->setBrandId('your_brand_id_here');
$gateway->setTestMode(true); // Use false for production

// Configure webhook verification (choose one method)
$gateway->setWebhookSecret('your_webhook_secret'); // For HMAC verification
// OR
// $gateway->setWebhookPublicKey($publicKey); // For RSA verification

// Create a payment with enhanced options
$response = $gateway->purchase([
    'amount' => '50.00',
    'currency' => 'MYR',
    'transactionId' => 'ORDER-' . time(),
    'description' => 'Product Purchase',
    'returnUrl' => 'https://yoursite.com/payment/return',
    'cancelUrl' => 'https://yoursite.com/payment/cancel',
    'failureUrl' => 'https://yoursite.com/payment/failure',
    'webhookUrl' => 'https://yoursite.com/payment/webhook',

    // Customer details
    'clientDetails' => [
        'email' => 'customer@example.com',
        'phone' => '+60123456789',
        'fullName' => 'John Doe',
    ],

    // Product information
    'purchaseDetails' => [
        'products' => [
            [
                'name' => 'Premium Product',
                'price' => 5000, // Amount in cents
                'quantity' => 1,
                'description' => 'High-quality premium product'
            ]
        ]
    ],

    // Advanced options
    'dueDate' => date('Y-m-d H:i:s', strtotime('+1 hour')),
    'timezone' => 'Asia/Kuala_Lumpur',
    'creatorAgent' => 'MyApp/1.0'
])->send();

if ($response->isRedirect()) {
    // Store transaction reference for later verification
    $_SESSION['purchase_id'] = $response->getTransactionReference();
    $response->redirect();
} else {
    echo 'Error: ' . $response->getMessage();
}
```

Advanced Configuration
----------------------

[](#advanced-configuration)

### Complete Payment with All Options

[](#complete-payment-with-all-options)

```
use Omnipay\Omnipay;

$gateway = Omnipay::create('ChipInAsia');
$gateway->setApiKey('your_api_key_here');
$gateway->setBrandId('your_brand_id_here');
$gateway->setTestMode(true);

$response = $gateway->purchase([
    // Required parameters
    'amount' => '299.99',
    'currency' => 'MYR',
    'transactionId' => 'ORD-' . date('YmdHis') . '-' . rand(1000, 9999),
    'description' => 'Premium Product Package - Complete package with premium features',
    'returnUrl' => 'https://yoursite.com/payment/return',
    'cancelUrl' => 'https://yoursite.com/payment/cancel',
    'failureUrl' => 'https://yoursite.com/payment/failure',
    'webhookUrl' => 'https://yoursite.com/payment/webhook',

    // Customer information
    'card' => [
        'email' => 'jane.smith@example.com',
        'firstName' => 'Jane',
        'lastName' => 'Smith',
        'phone' => '+60123456789',
    ],

    // Additional metadata
    'metadata' => [
        'product_id' => 'PROD-12345',
        'customer_tier' => 'premium',
        'promotion_code' => 'SAVE20',
        'notes' => 'Express delivery requested'
    ]
])->send();

if ($response->isRedirect()) {
    // Store transaction details before redirect
    $_SESSION['transaction_id'] = $response->getTransactionReference();
    $_SESSION['order_id'] = $options['transactionId'];

    $response->redirect();
} else {
    throw new Exception('Payment creation failed: ' . $response->getMessage());
}
```

### Multi-Currency Support

[](#multi-currency-support)

```
// Malaysian Ringgit
$response = $gateway->purchase([
    'amount' => '50.00',
    'currency' => 'MYR',
    // ... other parameters
]);

// Singapore Dollar
$response = $gateway->purchase([
    'amount' => '35.00',
    'currency' => 'SGD',
    // ... other parameters
]);

// US Dollar
$response = $gateway->purchase([
    'amount' => '12.00',
    'currency' => 'USD',
    // ... other parameters
]);

// Thai Baht
$response = $gateway->purchase([
    'amount' => '400.00',
    'currency' => 'THB',
    // ... other parameters
]);

// Vietnamese Dong
$response = $gateway->purchase([
    'amount' => '280000.00',
    'currency' => 'VND',
    // ... other parameters
]);

// Indonesian Rupiah
$response = $gateway->purchase([
    'amount' => '180000.00',
    'currency' => 'IDR',
    // ... other parameters
]);
```

### Completing a Purchase

[](#completing-a-purchase)

After the customer completes payment and returns to your site, verify the payment:

```
// Complete the purchase
$response = $gateway->completePurchase([
    'transactionReference' => $_GET['purchase_id'], // From Chip-in Asia callback
])->send();

if ($response->isSuccessful()) {
    // Payment successful
    echo "Payment successful!";
    echo "Transaction Reference: " . $response->getTransactionReference();
    echo "Amount: " . $response->getAmount();
    echo "Currency: " . $response->getCurrency();
    echo "Payment Method: " . $response->getPaymentMethod();
    echo "Payment Date: " . $response->getPaymentDate();
} elseif ($response->isPending()) {
    // Payment pending
    echo "Payment is pending";
} else {
    // Payment failed
    echo "Payment failed: " . $response->getMessage();
}
```

Error Handling
--------------

[](#error-handling)

### Common Error Scenarios

[](#common-error-scenarios)

```
try {
    $response = $gateway->purchase($options)->send();

    if ($response->isRedirect()) {
        $response->redirect();
    } else {
        // Handle payment creation failure
        $errorMessage = $response->getMessage();
        $errorCode = $response->getCode();

        switch ($errorCode) {
            case 'INVALID_API_KEY':
                throw new Exception('Invalid API credentials provided');
            case 'INSUFFICIENT_FUNDS':
                throw new Exception('Insufficient funds in account');
            case 'INVALID_AMOUNT':
                throw new Exception('Invalid payment amount');
            default:
                throw new Exception('Payment failed: ' . $errorMessage);
        }
    }
} catch (\Omnipay\Common\Exception\InvalidRequestException $e) {
    // Handle invalid request parameters
    echo 'Invalid request: ' . $e->getMessage();
} catch (\Exception $e) {
    // Handle general errors
    echo 'Error: ' . $e->getMessage();
}
```

### Validation Best Practices

[](#validation-best-practices)

```
// Validate required parameters before making request
$requiredParams = ['amount', 'currency', 'transactionId', 'returnUrl'];
foreach ($requiredParams as $param) {
    if (empty($options[$param])) {
        throw new InvalidArgumentException("Missing required parameter: {$param}");
    }
}

// Validate amount format
if (!is_numeric($options['amount']) || $options['amount'] setApiKey(config('payment.chip.api_key'));
    $gateway->setBrandId(config('payment.chip.brand_id'));
    $gateway->setTestMode(config('payment.chip.test_mode'));

    $response = $gateway->purchase([
        'amount' => $request->amount,
        'currency' => 'MYR',
        'transactionId' => $request->order_id,
        'description' => $request->description,
        'returnUrl' => route('payment.success'),
        'cancelUrl' => route('payment.cancel'),
        'failureUrl' => route('payment.failure'),
        'webhookUrl' => route('payment.webhook'),
        'card' => [
            'email' => $request->email,
            'firstName' => $request->first_name,
            'lastName' => $request->last_name,
            'phone' => $request->phone,
        ]
    ])->send();

    if ($response->isRedirect()) {
        return redirect($response->getRedirectUrl());
    }

    return back()->withErrors(['payment' => $response->getMessage()]);
}

public function handleSuccess(Request $request)
{
    $gateway = Omnipay::create('ChipInAsia');
    $gateway->setApiKey(config('payment.chip.api_key'));

    $response = $gateway->completePurchase([
        'transactionReference' => $request->purchase_id,
    ])->send();

    if ($response->isSuccessful()) {
        // Update order status in database
        return view('payment.success', [
            'transactionId' => $response->getTransactionReference(),
            'amount' => $response->getAmount(),
        ]);
    }

    return view('payment.failed', [
        'message' => $response->getMessage()
    ]);
}
```

Security Best Practices
-----------------------

[](#security-best-practices)

### API Key Management

[](#api-key-management)

```
// Store API keys securely in environment variables
$gateway->setApiKey(getenv('CHIP_API_KEY'));
$gateway->setBrandId(getenv('CHIP_BRAND_ID'));

// Never hardcode credentials in your source code
// ❌ Bad
$gateway->setApiKey('sk_live_1234567890abcdef');

// ✅ Good
$gateway->setApiKey($_ENV['CHIP_API_KEY']);
```

### Webhook Security

[](#webhook-security)

```
// Verify webhook signatures to ensure authenticity
public function handleWebhook(Request $request)
{
    $signature = $request->header('X-Signature');
    $payload = $request->getContent();

    // Verify signature using your webhook secret
    $expectedSignature = hash_hmac('sha256', $payload, $webhookSecret);

    if (!hash_equals($signature, $expectedSignature)) {
        return response('Unauthorized', 401);
    }

    // Process webhook...
}
```

### Data Validation

[](#data-validation)

```
// Sanitize and validate all input data
$amount = filter_var($request->amount, FILTER_VALIDATE_FLOAT);
if ($amount === false || $amount email, FILTER_VALIDATE_EMAIL);
if ($email === false) {
    throw new InvalidArgumentException('Invalid email address');
}
```

Troubleshooting
---------------

[](#troubleshooting)

### Common Issues

[](#common-issues)

#### 1. "Invalid API Key" Error

[](#1-invalid-api-key-error)

```
// Check if API key is correctly set
if (empty($gateway->getApiKey())) {
    throw new Exception('API key not configured');
}

// Verify API key format
if (!preg_match('/^sk_(test|live)_[a-zA-Z0-9]{32}$/', $gateway->getApiKey())) {
    throw new Exception('Invalid API key format');
}
```

#### 2. Webhook Not Receiving Data

[](#2-webhook-not-receiving-data)

```
// Ensure webhook URL is publicly accessible
// Test webhook endpoint manually
curl -X POST https://yoursite.com/webhook \
  -H "Content-Type: application/json" \
  -d '{"test": "data"}'

// Check webhook URL configuration
if (!filter_var($webhookUrl, FILTER_VALIDATE_URL)) {
    throw new Exception('Invalid webhook URL');
}
```

#### 3. Payment Redirect Issues

[](#3-payment-redirect-issues)

```
// Ensure return URLs are properly configured
$returnUrls = ['returnUrl', 'cancelUrl', 'failureUrl'];
foreach ($returnUrls as $urlKey) {
    if (!empty($options[$urlKey]) && !filter_var($options[$urlKey], FILTER_VALIDATE_URL)) {
        throw new Exception("Invalid {$urlKey}");
    }
}
```

### Debug Mode

[](#debug-mode)

```
// Enable debug mode for detailed error information
$gateway->setTestMode(true);

// Log all API requests and responses
$gateway->setLogger(new \Monolog\Logger('chip-in-asia'));
```

### Configuration Options

[](#configuration-options)

#### Gateway Configuration

[](#gateway-configuration)

ParameterDescriptionRequiredType`apiKey`Your CHIP API keyYesstring`brandId`Your CHIP Brand IDYesstring`testMode`Set to true for testing environmentNoboolean`webhookSecret`Webhook secret for HMAC verificationNo\*string`webhookPublicKey`Public key for RSA verificationNo\*string`creatorAgent`User agent identifier for API callsNostring\*Either `webhookSecret` or `webhookPublicKey` is required for webhook verification.

#### Purchase Parameters

[](#purchase-parameters)

ParameterDescriptionRequiredType`amount`Payment amountYesstring/float`currency`Payment currency (MYR, SGD, USD, THB, VND, IDR)Yesstring`transactionId`Your unique transaction identifierYesstring`description`Payment descriptionNostring`returnUrl`Success redirect URLNostring`cancelUrl`Cancel redirect URLNostring`failureUrl`Failure redirect URLNostring`webhookUrl`Webhook notification URLNostring`dueDate`Payment due date (ISO 8601 format)Nostring`timezone`Timezone for due dateNostring`clientDetails`Customer information objectNoarray`purchaseDetails`Product/purchase information objectNoarray`metadata`Additional custom dataNoarray#### Client Details Structure

[](#client-details-structure)

FieldDescriptionType`email`Customer email addressstring`phone`Customer phone numberstring`fullName`Customer full namestring#### Purchase Details Structure

[](#purchase-details-structure)

FieldDescriptionType`products`Array of product objectsarray`products[].name`Product namestring`products[].price`Product price in centsinteger`products[].quantity`Product quantityinteger`products[].description`Product descriptionstringWebhooks
--------

[](#webhooks)

CHIP sends webhook notifications for payment status updates. This package supports both HMAC and RSA signature verification methods for enhanced security.

### Webhook Handler with HMAC Verification

[](#webhook-handler-with-hmac-verification)

```
use Omnipay\ChipInAsia\Message\WebhookRequest;
use Omnipay\ChipInAsia\Exception\WebhookException;

public function handleWebhook(Request $request)
{
    try {
        // Create webhook request with HMAC verification
        $webhookRequest = new WebhookRequest(
            $this->getHttpClient(),
            $request
        );

        // Set webhook secret for HMAC verification
        $webhookRequest->setWebhookSecret(config('payment.chip.webhook_secret'));

        // Verify and parse webhook data
        $data = $webhookRequest->getData();

        // Process the verified webhook data
        $this->processWebhookData($data);

        return response('OK', 200);

    } catch (WebhookException $e) {
        Log::error('Webhook verification failed: ' . $e->getMessage());
        return response('Unauthorized', 401);
    } catch (\Exception $e) {
        Log::error('Webhook processing error: ' . $e->getMessage());
        return response('Internal Server Error', 500);
    }
}
```

### Webhook Handler with RSA Verification

[](#webhook-handler-with-rsa-verification)

```
public function handleWebhookRSA(Request $request)
{
    try {
        // Create webhook request with RSA verification
        $webhookRequest = new WebhookRequest(
            $this->getHttpClient(),
            $request
        );

        // Set public key for RSA verification
        $publicKey = config('payment.chip.webhook_public_key');
        $webhookRequest->setWebhookPublicKey($publicKey);

        // Verify and parse webhook data
        $data = $webhookRequest->getData();

        // Process the verified webhook data
        $this->processWebhookData($data);

        return response('OK', 200);

    } catch (WebhookException $e) {
        Log::error('RSA webhook verification failed: ' . $e->getMessage());
        return response('Unauthorized', 401);
    }
}

private function processWebhookData(array $data)
{
    $purchaseId = $data['id'];
    $status = $data['status'];

    // Get additional webhook response details
    $webhookResponse = new \Omnipay\ChipInAsia\Message\WebhookResponse(null, $data);

    if ($webhookResponse->isPaymentSuccessful()) {
        // Update order status to paid
        Order::where('purchase_id', $purchaseId)->update([
            'status' => 'paid',
            'payment_method' => $webhookResponse->getPaymentMethod(),
            'payment_date' => $webhookResponse->getPaymentDate(),
            'amount' => $webhookResponse->getAmount(),
            'currency' => $webhookResponse->getCurrency()
        ]);

        // Send confirmation email
        $order = Order::where('purchase_id', $purchaseId)->first();
        Mail::to($order->customer_email)->send(new PaymentConfirmation($order));

    } elseif ($webhookResponse->isPaymentCancelled()) {
        // Handle cancelled payment
        Order::where('purchase_id', $purchaseId)->update(['status' => 'cancelled']);

    } elseif ($webhookResponse->isPaymentExpired()) {
        // Handle expired payment
        Order::where('purchase_id', $purchaseId)->update(['status' => 'expired']);

    } elseif ($webhookResponse->isPaymentPending()) {
        // Handle pending payment
        Order::where('purchase_id', $purchaseId)->update(['status' => 'pending']);
    }
}
```

### Webhook Event Types

[](#webhook-event-types)

```
// Handle different webhook events
$eventType = $request->input('event_type');

switch ($eventType) {
    case 'payment.successful':
        $this->handleSuccessfulPayment($request);
        break;
    case 'payment.failed':
        $this->handleFailedPayment($request);
        break;
    case 'payment.cancelled':
        $this->handleCancelledPayment($request);
        break;
    case 'payment.pending':
        $this->handlePendingPayment($request);
        break;
    default:
        Log::warning('Unknown webhook event type: ' . $eventType);
}
```

API Reference
-------------

[](#api-reference)

### Gateway Methods

[](#gateway-methods)

#### `purchase(array $options)`

[](#purchasearray-options)

Create a purchase request and redirect customer to payment page.

**Parameters:**

- `amount` (string|float) - Payment amount
- `currency` (string) - Payment currency (MYR, SGD, USD)
- `transactionId` (string) - Your unique transaction identifier
- `description` (string) - Payment description
- `returnUrl` (string) - Success redirect URL
- `cancelUrl` (string) - Cancel redirect URL
- `failureUrl` (string) - Failure redirect URL
- `webhookUrl` (string) - Webhook notification URL
- `card` (array) - Customer information
- `metadata` (array) - Additional custom data

**Returns:** `PurchaseResponse`

#### `completePurchase(array $options)`

[](#completepurchasearray-options)

Complete/verify a purchase after customer returns from payment page.

**Parameters:**

- `transactionReference` (string) - Purchase ID from Chip-in Asia

**Returns:** `CompletePurchaseResponse`

### Response Methods

[](#response-methods)

#### PurchaseResponse

[](#purchaseresponse)

- `isSuccessful()` - Always returns false (redirect required)
- `isRedirect()` - Returns true if redirect URL is available
- `getRedirectUrl()` - Get the payment page URL
- `getTransactionReference()` - Get the purchase ID
- `getMessage()` - Get error message if failed
- `getCode()` - Get error code if failed

#### CompletePurchaseResponse

[](#completepurchaseresponse)

- `isSuccessful()` - Returns true if payment completed successfully
- `isPending()` - Returns true if payment is pending
- `isCancelled()` - Returns true if payment was cancelled
- `getTransactionReference()` - Get the purchase ID
- `getTransactionId()` - Get your original transaction ID
- `getAmount()` - Get the payment amount
- `getCurrency()` - Get the payment currency
- `getPaymentMethod()` - Get the payment method used (fpx\_bank, credit\_card, etc.)
- `getPaymentDate()` - Get the payment date (ISO 8601 format)
- `getMessage()` - Get status message
- `getCode()` - Get status code
- `getData()` - Get raw response data

### Exception Classes

[](#exception-classes)

#### `ChipInAsiaException`

[](#chipinasiaexception)

Base exception class for all Chip-in Asia related errors.

#### `InvalidRequestException`

[](#invalidrequestexception)

Thrown when request parameters are invalid.

#### `ApiException`

[](#apiexception)

Thrown when API returns an error response.

#### `WebhookException`

[](#webhookexception)

Thrown when webhook verification fails.

Testing
-------

[](#testing)

### Running Tests

[](#running-tests)

Run the complete test suite:

```
composer test
```

Run specific test categories:

```
# Unit tests only
./vendor/bin/phpunit --testsuite=unit

# Integration tests only
./vendor/bin/phpunit --testsuite=integration

# Test with coverage
./vendor/bin/phpunit --coverage-html coverage
```

### Test Mode

[](#test-mode)

Use test mode for development and testing:

```
$gateway = Omnipay::create('ChipInAsia');
$gateway->setTestMode(true);
$gateway->setApiKey('sk_test_your_test_api_key');
$gateway->setBrandId('your_test_brand_id');
```

### Test Cards

[](#test-cards)

Use these test card numbers in test mode:

Card NumberDescriptionExpected Result4111111111111111VisaSuccess4000000000000002VisaDeclined5555555555554444MastercardSuccess5200000000000007MastercardDeclined### Mock Responses

[](#mock-responses)

The package includes mock responses for testing:

```
// Test successful purchase
$mockResponse = file_get_contents(__DIR__ . '/Mock/PurchaseSuccess.txt');
$this->setMockHttpResponse($mockResponse);

// Test failed purchase
$mockResponse = file_get_contents(__DIR__ . '/Mock/PurchaseFailure.txt');
$this->setMockHttpResponse($mockResponse);
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- **Author**: [Sitehandy Solutions](https://www.sitehandy.com)
- **Website**: [www.sitehandy.com](https://www.sitehandy.com)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

Support
-------

[](#support)

For support, please contact:

- Email:
- GitHub Issues: [Create an issue](https://github.com/sitehandy/omnipay-chipinasia/issues)

Changelog
---------

[](#changelog)

### \[2.0.0\] - 2024-01-20

[](#200---2024-01-20)

#### Added

[](#added)

- **Dual Signature Verification**: Support for both HMAC (webhook secret) and RSA (public key) signature verification
- **Enhanced Currency Support**: Added THB, VND, IDR to existing MYR, SGD, USD support
- **Advanced Purchase Options**: Due dates, timezones, creator agents, and enhanced metadata
- **Modern PHP Support**: Updated to require PHP 8.0+ with strict typing
- **Comprehensive Test Suite**: 56 tests with 111 assertions covering all functionality
- **Enhanced Client/Purchase Details**: Structured data models for better API integration
- **WebhookRequest/WebhookResponse Classes**: Dedicated classes for webhook handling
- **WebhookVerifier Class**: Advanced signature verification with logging support
- **Exception Hierarchy**: Specific exception classes for different error types

#### Enhanced Features

[](#enhanced-features)

- **Multi-Currency Support**: MYR, SGD, USD, THB, VND, IDR
- **Customer Information Handling**: Enhanced client details structure
- **Redirect-based Payment Flow**: Improved with better error handling
- **Real-time Payment Verification**: Enhanced webhook processing
- **Test Mode Support**: Comprehensive testing capabilities
- **Metadata Support**: Enhanced custom fields and product information
- **Security Best Practices**: RSA signature verification and enhanced validation
- **Laravel Integration**: Ready-to-use examples and service providers

#### Breaking Changes

[](#breaking-changes)

- Minimum PHP version increased to 8.0
- `card` parameter replaced with `clientDetails` for customer information
- Enhanced webhook verification requires either `webhookSecret` or `webhookPublicKey`
- Updated response methods for better type safety

### \[1.0.0\] - 2024-01-15

[](#100---2024-01-15)

#### Added

[](#added-1)

- Initial release of Omnipay CHIP gateway
- Support for purchase and completePurchase operations
- Full integration with CHIP API
- Basic test suite
- Laravel integration examples
- Webhook handling support
- Exception handling classes
- Basic webhook signature verification

### Future Releases

[](#future-releases)

- Additional payment methods (QR codes, bank transfers)
- Enhanced reporting and analytics
- Subscription and recurring payment support
- Improved webhook security
- Recurring payment support
- Refund functionality

Chip-in Asia Documentation
--------------------------

[](#chip-in-asia-documentation)

For more information about Chip-in Asia API, visit:

- [Official Documentation](https://docs.chip-in.asia/)
- [API Reference](https://docs.chip-in.asia/chip-collect/server-api/)
- [Webhook Guide](https://docs.chip-in.asia/chip-collect/webhooks/)
- [Testing Guide](https://docs.chip-in.asia/chip-collect/testing/)

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance58

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Every ~0 days

Total

3

Last Release

267d ago

PHP version history (2 changes)v1.0.0PHP ^7.4|^8.0|^8.1|^8.2|^8.3|^8.4

1.0.1PHP ^8.0|^8.1|^8.2|^8.3|^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/ecbe713eb8a62b8aaf0a6e86eb18bad1a1e6410fc8d2b4a47da6dbfeeff5d16c?d=identicon)[sitehandy](/maintainers/sitehandy)

---

Top Contributors

[![sitehandy](https://avatars.githubusercontent.com/u/22477788?v=4)](https://github.com/sitehandy "sitehandy (11 commits)")

---

Tags

signaturersapaymentgatewaywebhookpaymerchantomnipaypurchaseverificationhmacthailandMalaysiachipSingaporechipinasiachip-in-asia

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sitehandy-omnipay-chipinasia/health.svg)

```
[![Health](https://phpackages.com/badges/sitehandy-omnipay-chipinasia/health.svg)](https://phpackages.com/packages/sitehandy-omnipay-chipinasia)
```

PHPackages © 2026

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