PHPackages                             taut-id/payment - 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. taut-id/payment

ActiveLibrary[Payment Processing](/categories/payments)

taut-id/payment
===============

payment starter kit package

05[3 PRs](https://github.com/tautid/payment/pulls)PHPCI passing

Since Nov 24Pushed 2mo agoCompare

[ Source](https://github.com/tautid/payment)[ Packagist](https://packagist.org/packages/taut-id/payment)[ RSS](/packages/taut-id-payment/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (5)Used By (0)

Taut Payment
============

[](#taut-payment)

A comprehensive Laravel package for handling payment transactions with multiple payment gateways, customizable state transitions, and webhook integrations. Built on top of Spatie Laravel Data for robust data handling and type safety.

Features
--------

[](#features)

- **Multiple Payment Drivers**: Support for Moota Transaction, Bayarind, and offline payment methods
- **State Machine**: Built-in payment status transitions with customizable hooks
- **Webhook Integration**: Automatic webhook handling for payment gateway notifications
- **Type-Safe Data Layer**: Using Spatie Laravel Data for consistent data structures
- **Flexible Filtering**: Advanced pagination and filtering capabilities
- **Payment Gateway Integration**: Ready-to-use drivers for popular Indonesian payment gateways

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

[](#installation)

Install the package via composer:

```
composer require tautid/payment
```

Publish the configuration file:

```
php artisan vendor:publish --tag="taut-payment-config"
```

Publish the seeder file (optional):

```
php artisan vendor:publish --tag="taut-payment-seeders"
```

Publish the payment migrations:

```
php artisan vendor:publish --tag="taut-payment-migrations"
```

Publish the webhook client config:

```
php artisan vendor:publish --provider="Spatie\WebhookClient\WebhookClientServiceProvider" --tag="webhook-client-config"
```

Run the migrations:

```
php artisan migrate
```

Important

**Remove the default config in webhook-client after publishing.**

This step is crucial to ensure proper configuration of the webhook client for your application.

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

[](#configuration)

The package uses a configuration file `config/taut-payment.php` where you can configure:

- **Available drivers**: Enable/disable payment drivers
- **Transitions namespace**: Customize where transition classes are located
- **API credentials**: Set up payment gateway credentials (use environment variables)

Core Concepts
-------------

[](#core-concepts)

### Payment Status Flow

[](#payment-status-flow)

The package uses a state machine for payment statuses:

1. **Created** → **Pending** → **Completed/Due/Canceled/Failed**

Available status transitions:

- `Created`: Initial payment state
- `Pending`: Payment awaiting completion
- `Due`: Payment has expired
- `Completed`: Payment successfully processed
- `Canceled`: Payment canceled by admin/system
- `Failed`: Payment processing failed

### Payment Drivers

[](#payment-drivers)

The package supports multiple payment drivers:

1. **Offline Driver**: For cash payments and manual transactions
2. **Moota Transaction Driver**: Indonesian bank transfer integration with VA and QRIS support
3. **Bayarind Driver**: Multi-channel payment gateway supporting various e-wallets and VA

### Data Transfer Objects (DTOs)

[](#data-transfer-objects-dtos)

All data in the package is handled through type-safe Data Transfer Objects using Spatie Laravel Data:

- **PaymentData**: Complete payment information
- **CreatePaymentData**: Data required to create a new payment
- **PaymentMethodData**: Payment method information
- **CreatePaymentMethodData**: Data for creating payment methods
- **UpdatePaymentMethodData**: Data for updating payment methods
- **FilterPaginationData**: Advanced filtering and pagination data

Available Commands
------------------

[](#available-commands)

This package provides powerful artisan commands:

### 1. Payment Due Command

[](#1-payment-due-command)

Automatically changes pending payments to due status when they exceed their due date:

```
php artisan taut-payment:due
```

You can schedule this command to run periodically in your `app/Console/Kernel.php`:

```
protected function schedule(Schedule $schedule)
{
    $schedule->command('taut-payment:due')->hourly();
}
```

### 2. Make Transitions Command

[](#2-make-transitions-command)

Generates custom transition files for handling payment state changes:

```
php artisan taut-payment:make-transitions
```

Payment Transitions System
--------------------------

[](#payment-transitions-system)

The package uses a powerful state machine system for handling payment status changes. You can add custom business logic to each transition.

### Available Transitions

[](#available-transitions)

The system includes the following transitions:

- `ToPending` - When payment moves to pending status
- `ToCanceled` - When payment is canceled
- `ToCompleted` - When payment is successfully completed
- `ToDue` - When payment becomes overdue
- `ToFailed` - When payment processing fails

### Creating Custom Transitions

[](#creating-custom-transitions)

Generate custom transition files using the artisan command:

```
php artisan taut-payment:make-transitions
```

This creates transition files in your `app/Transitions/Payment/` directory that you can customize.

### Custom Transition Examples

[](#custom-transition-examples)

```
