osa-eg / laravel-tabby-integration
The package acts as a Laravel integration for the Tabby API, allowing developers to easily create sessions, handle payments, and manage webhooks in their applications.
Requires
- php: >=8.0
- guzzlehttp/guzzle: ^7.0
- illuminate/support: ^8.0 || ^9.0 || ^10.0 || ^11.0
README
laravel-tabby-integration
is a Laravel package designed to simplify the integration of the Tabby API into your Laravel applications. It provides an easy-to-use interface for creating checkout sessions, handling payments, managing webhooks, and more.
Features
- Create, retrieve, update, and capture payments
- Register, retrieve, update, and remove webhooks
- Integrated logging for API requests and responses
- Simple and intuitive interface
Installation
To install the package, use Composer:
composer require osa-eg/laravel-tabby-integration
Configuration
Publish the configuration file:
php artisan vendor:publish --provider="Osama\TabbyIntegration\Providers\TabbyServiceProvider"
In your .env
file, add the following configurations:
TABBY_PUBLIC_KEY=your_public_key TABBY_SECRET_KEY=your_secret_key TABBY_MERCHANT_CODE=your_merchant_code
Usage
Create a Checkout Session
Create a new checkout session with the given data.
use Osama\TabbyIntegration\Facades\Tabby; $data = [ // your checkout session data ]; $response = Tabby::createCheckoutSession($data);
Reference: Post Checkout Session
Retrieve a Payment
Retrieve a payment by its ID.
$paymentId = 'your_payment_id'; $response = Tabby::getPayment($paymentId);
Reference: Get Payment
Update a Payment
Update a payment by its ID with new data.
$paymentId = 'your_payment_id'; $data = [ // your update data ]; $response = Tabby::updatePayment($paymentId, $data);
Reference: Update Payment
Capture a Payment
Capture a payment by its ID.
$paymentId = 'your_payment_id'; $data = [ // your capture data ]; $response = Tabby::capturePayment($paymentId, $data);
Reference: Capture Payment
Refund a Payment
Refund a payment by its ID.
$paymentId = 'your_payment_id'; $data = [ // your refund data ]; $response = Tabby::refundPayment($paymentId, $data);
Reference: Refund Payment
List Payments
Retrieve a list of payments with optional parameters.
$params = [ // your query parameters ]; $response = Tabby::listPayments($params);
Reference: List Payments
Register a Webhook
Register a new webhook with the given data.
$data = [ // your webhook data ]; $response = Tabby::registerWebhook($data);
Reference: Post Webhook
List Webhooks
Retrieve a list of webhooks.
$response = Tabby::listWebhooks();
Reference: Get Webhooks
Retrieve a Webhook
Retrieve a specific webhook by its ID.
$webhookId = 'your_webhook_id'; $response = Tabby::getWebhook($webhookId);
Reference: Get Webhook
Update a Webhook
Update a specific webhook by its ID with new data.
$webhookId = 'your_webhook_id'; $data = [ // your update data ]; $response = Tabby::updateWebhook($webhookId, $data);
Reference: Update Webhook
Remove a Webhook
Remove a specific webhook by its ID.
$webhookId = 'your_webhook_id'; $response = Tabby::removeWebhook($webhookId);
Reference: Delete Webhook
Logging
The package integrates with Laravel's logging system to provide detailed logs of API requests and responses. Ensure you have a logger configured in your Laravel application to capture these logs.
License
This package is licensed under the MIT License. See the LICENSE file for more details.