PHPackages                             kidacallos/smilepayz-sdk - 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. [API Development](/categories/api)
4. /
5. kidacallos/smilepayz-sdk

ActiveLibrary[API Development](/categories/api)

kidacallos/smilepayz-sdk
========================

A laravel package wrapper for integrating with SmilePayz API

10PHP

Since May 25Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/kennethdacallos/smilepayz-sdk)[ Packagist](https://packagist.org/packages/kidacallos/smilepayz-sdk)[ RSS](/packages/kidacallos-smilepayz-sdk/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

SmilePayz SDK
=============

[](#smilepayz-sdk)

[![MIT Licensed](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A Laravel package wrapper for integrating with SmilePayz API. This SDK provides a simple and elegant way to handle payment processing through SmilePayz in your Laravel application.

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

[](#table-of-contents)

- [Features](#features)
- [Requirements](#requirements)
- [Quick Start](#quick-start)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Basic Setup](#basic-setup)
    - [Processing a Pay-in Transaction](#processing-a-pay-in-transaction)
    - [Processing a Pay-out Transaction](#processing-a-pay-out-transaction)
    - [Verifying Signatures](#verifying-signatures)
- [Response Handling](#response-handling)
- [Error Handling](#error-handling)
- [Common Use Cases](#common-use-cases)
- [Security](#security)
- [Contributing](#contributing)
- [License](#license)
- [Author](#author)

Features
--------

[](#features)

- Pay-in transaction processing
- Pay-out transaction processing
- Signature verification
- Comprehensive response handling
- Laravel integration with Service Provider and Facade

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

[](#requirements)

- PHP 8.0 or higher
- Laravel 8.0 or higher
- Guzzle HTTP Client
- OpenSSL Extension

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

[](#quick-start)

1. Install the package:

```
composer require kidacallos/smilepayz-sdk
```

2. Set up your environment variables in `.env`:

```
SMILEPAYZ_API_URL=https://sandbox-gateway.smilepayz.com
SMILEPAYZ_MERCHANT_ID=your-merchant-id
SMILEPAYZ_MERCHANT_SECRET=your-merchant-secret
SMILEPAYZ_PUBLIC_KEY=your-platform-public-key
SMILEPAYZ_PRIVATE_KEY=your-private-key

```

3. Process your first payment:

```
use Kidacallos\SmilepayzSdk\SmilePayz;

$smile_payz = new SmilePayz();
$smile_payz->setVault([
    'api_url' => env('SMILEPAYZ_API_URL'),
    'merchant_id' => env('SMILEPAYZ_MERCHANT_ID'),
    'merchant_secret' => env('SMILEPAYZ_MERCHANT_SECRET'),
    'public_key' => env('SMILEPAYZ_PUBLIC_KEY'),
    'private_key' => env('SMILEPAYZ_PRIVATE_KEY'),
]);

$response = $smile_payz->validateDeposit([
    'order_no' => 'ORDER123',
    'money' => [
        'amount' => 1000.00,
        'currency' => 'IDR'
    ]
    // ... other required fields
])->payIn();
```

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

[](#installation)

You can install the package via composer:

```
composer require kidacallos/smilepayz-sdk
```

The package will automatically register its service provider and facade.

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

[](#configuration)

### Using Environment Variables

[](#using-environment-variables)

We recommend using environment variables for your SmilePayz configuration. Add the following to your `.env` file:

```
SMILEPAYZ_API_URL=https://sandbox-gateway.smilepayz.com
SMILEPAYZ_MERCHANT_ID=your-merchant-id
SMILEPAYZ_MERCHANT_SECRET=your-merchant-secret
SMILEPAYZ_PUBLIC_KEY=your-platform-public-key
SMILEPAYZ_PRIVATE_KEY=your-private-key
```

Then in your configuration:

```
$smile_payz = new SmilePayz();
$smile_payz->setVault([
    'api_url' => env('SMILEPAYZ_API_URL'),
    'merchant_id' => env('SMILEPAYZ_MERCHANT_ID'),
    'merchant_secret' => env('SMILEPAYZ_MERCHANT_SECRET'),
    'public_key' => env('SMILEPAYZ_PUBLIC_KEY'),
    'private_key' => env('SMILEPAYZ_PRIVATE_KEY'),
]);
```

Usage
-----

[](#usage)

### Basic Setup

[](#basic-setup)

First, initialize SmilePayz and set your configuration:

```
use Kidacallos\SmilepayzSdk\SmilePayz;

$smile_payz = new SmilePayz();
$smile_payz->setVault([
    'api_url' => env('SMILEPAYZ_API_URL'),
    'merchant_id' => env('SMILEPAYZ_MERCHANT_ID'),
    'merchant_secret' => env('SMILEPAYZ_MERCHANT_SECRET'),
    'public_key' => env('SMILEPAYZ_PUBLIC_KEY'),
    'private_key' => env('SMILEPAYZ_PRIVATE_KEY'),
]);
```

### Processing a Pay-in Transaction

[](#processing-a-pay-in-transaction)

```
$payload = [
    'area' => 10,
    'callback_url' => 'https://your-callback-url.com/callback',
    'expiry_period' => 3600, // Optional
    'merchant' => [
        'merchant_id' => 'your-merchant-id'
    ],
    'money' => [
        'amount' => 1000.00,
        'currency' => 'IDR'
    ],
    'order_no' => 'ORDER123456',
    'payer' => [
        'address' => '123 Main St',
        'email' => 'customer@example.com',
        'name' => 'John Doe',
        'phone' => '+639123456789'
    ],
    'payment_method' => 'BCA', // Optional
    'purpose' => 'Pay-in Transaction',
    'redirect_url' => 'https://your-redirect-url.com/success'
];

try {
    $response = $smile_payz->validateDeposit($payload)->payIn();

    // Access response data
    $trade_no = $response->getTradeNo();
    $status = $response->getStatus();
    $transaction_time = $response->getTransactionTime();

} catch (InvalidArgumentException $e) {
    // Handle validation errors
} catch (VaultNotFoundException $e) {
    // Handle missing configuration
} catch (FailedResponseException $e) {
    // Handle API errors
}
```

### Processing a Pay-out Transaction

[](#processing-a-pay-out-transaction)

```
$payload = [
    'area' => 10,
    'callback_url' => 'https://your-callback-url.com/callback',
    'cash_account' => 'ACCOUNT123',
    'merchant' => [
        'merchant_id' => 'your-merchant-id'
    ],
    'money' => [
        'amount' => 1000.00,
        'currency' => 'IDR'
    ],
    'order_no' => 'ORDER123456',
    'payment_method' => 'ACEH',
    'purpose' => 'Pay-out Transaction'
];

try {
    $response = $smile_payz->validateWithdrawal($payload)->payOut();

    // Access response data
    $trade_no = $response->getTradeNo();
    $status = $response->getStatus();
    $disbursement_time = $response->getDisbursementTime();

} catch (InvalidArgumentException $e) {
    // Handle validation errors
} catch (VaultNotFoundException $e) {
    // Handle missing configuration
} catch (FailedResponseException $e) {
    // Handle API errors
}
```

### Verifying Signatures

[](#verifying-signatures)

```
try {
    $is_valid = $smile_payz->verifySignature(
        $trade_no,
        $timestamp,
        $signature
    );

    if ($is_valid === 1) {
        // Signature is valid
    } else if ($is_valid === 0) {
        // Signature is invalid
    } else {
        // Error occurred during verification
    }
} catch (Exception $e) {
    // Handle verification errors
}
```

Response Handling
-----------------

[](#response-handling)

Both pay-in and pay-out operations return response objects (`PayInResponse` and `PayOutResponse` respectively) with the following methods:

- `getCode()`: Get the response code
- `getMessage()`: Get the response message
- `getOrderNo()`: Get the order number
- `getMerchant()`: Get merchant information
- `getMoney()`: Get transaction amount and currency
- `getChannel()`: Get payment channel information
- `getTradeNo()`: Get the trade number
- `getStatus()`: Get transaction status

Pay-in responses additionally include:

- `getTransactionTime()`: Get the transaction timestamp

Pay-out responses additionally include:

- `getDisbursementTime()`: Get the disbursement timestamp

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

[](#error-handling)

The SDK throws the following exceptions:

- `InvalidArgumentException`: When payload validation fails
- `VaultNotFoundException`: When SDK configuration is missing
- `FailedResponseException`: When the API request fails
- `Exception`: For general errors

Common Use Cases
----------------

[](#common-use-cases)

### Processing a Simple Payment

[](#processing-a-simple-payment)

```
use Kidacallos\SmilepayzSdk\SmilePayz;

$smile_payz = new SmilePayz();
$smile_payz->setVault([
    'api_url' => env('SMILEPAYZ_API_URL'),
    'merchant_id' => env('SMILEPAYZ_MERCHANT_ID'),
    'merchant_secret' => env('SMILEPAYZ_MERCHANT_SECRET'),
    'public_key' => env('SMILEPAYZ_PUBLIC_KEY'),
    'private_key' => env('SMILEPAYZ_PRIVATE_KEY'),
]);

$response = $smile_payz->validateDeposit([
    'order_no' => 'ORDER123',
    'money' => [
        'amount' => 1000.00,
        'currency' => 'IDR'
    ],
    'payer' => [
        'email' => 'customer@example.com',
        'name' => 'John Doe'
    ]
])->payIn();
```

### Handling Callbacks

[](#handling-callbacks)

```
public function handleCallback(Request $request)
{
    $is_valid = $smile_payz->verifySignature(
        $request->trade_no,
        $request->timestamp,
        $request->signature
    );

    if ($is_valid === 1) {
        // Update your order status
        Order::where('trade_no', $request->trade_no)
            ->update(['status' => $request->status]);
    }
}
```

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

[](#contributing)

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

License
-------

[](#license)

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

Author
------

[](#author)

- Kenneth I. Dacallos ()

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity14

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2fb8da37e3450473f833a5c6cae26c64779f80d88ae6a2eee956f67a88958853?d=identicon)[kennethdacallos](/maintainers/kennethdacallos)

---

Top Contributors

[![kennethdacallos](https://avatars.githubusercontent.com/u/34506049?v=4)](https://github.com/kennethdacallos "kennethdacallos (3 commits)")

### Embed Badge

![Health badge](/badges/kidacallos-smilepayz-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/kidacallos-smilepayz-sdk/health.svg)](https://phpackages.com/packages/kidacallos-smilepayz-sdk)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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