承接 granada-pride/paytabs 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

granada-pride/paytabs

Composer 安装命令:

composer require granada-pride/paytabs

包简介

This provide integration with the PayTabs payment gateway

README 文档

README

Github All Releases

PayTabs Payment Gateway Integration for Laravel

Table of Contents

  1. Description
  2. Installation
  3. Configuration
  4. Usage
  5. Troubleshooting
  6. Testing
  7. Contribution
  8. License

Description

PayTabs Payment Gateway Integration with Laravel Framework

Installation

You can install the package via composer:

composer require granada-pride/paytabs

Note: This package is compatible with Laravel 9 and higher. Ensure your application meets this requirement before installing.

Configuration

After installation, publish the configuration file using the following command:

php artisan vendor:publish --provider="GranadaPride\Paytabs\PaytabsServiceProvider"

The configuration file paytabs.php will be added to your config directory. Here is a sample configuration:

return [
    'profile_id' => env('PAYTABS_PROFILE_ID'),
    'server_key' => env('PAYTABS_SERVER_KEY'),
    'currency' => env('PAYTABS_CURRENCY'),
    'region' => env('PAYTABS_REGION'),
    'iframe_message_target' => env('PAYTABS_IFRAME_MESSAGE_TARGET'),
];

Configuration Options

  • profile_id: Your PayTabs profile ID, required for API requests.
  • server_key: Your PayTabs server key, used for authentication.
  • currency: The currency code in which payments will be processed (e.g., USD).
  • region: The region for your PayTabs account (e.g., ARE, SAU).

Usage

Create PayPage

Here’s how to create a payment page using this package:

use GranadaPride\Paytabs\Paytabs;
use GranadaPride\Paytabs\DTO\CustomerDetails;

$paytabs = Paytabs::make();

// Set Cart Information
$paytabs->setCart('CART123', 150.00, 'Sample Cart Description');

// Set Customer Information using the CustomerDetails DTO
$customerDetails = new CustomerDetails(
    name: 'John Doe',
    phone: '+123456789',
    email: 'johndoe@example.com',
    street: '123 Main St',
    city: 'Cityville',
    state: 'Stateland',
    country: 'US',
    zipCode: '12345'
);

$paytabs->setCustomer($customerDetails);

// Option 1: Use Customer Information for Shipping if it's the same
$paytabs->useCustomerForShipping();

// Option 2: Set Shipping Information separately if it's different
$shippingDetails = new CustomerDetails(
    name: 'Jane Doe',
    phone: '+987654321',
    email: 'janedoe@example.com',
    street: '456 Market St',
    city: 'Townsville',
    state: 'Regionland',
    country: 'US',
    zipCode: '54321'
);

$paytabs->setShipping($shippingDetails);

// Set URLs and Language
$paytabs->setCallbackUrl('https://yourdomain.com/callback')
        ->setReturnUrl('https://yourdomain.com/return')
        ->setPaypageLang('en');
        
// To display IFrame
$paytabs->displayIFrame();

// and you sholud update your .env with PAYTABS_IFRAME_MESSAGE_TARGET this A valid HTTPS website URL of your domain (the recipient) that will receive the event. In order for the event to be dispatched, this domain must match exactly (including scheme, hostname, and port).

// Generate Payment Page
$response = $paytabs->paypage();

// Handle the response
dd($response);

Query Transaction

You can also query a transaction using its reference:

use GranadaPride\Paytabs\Paytabs;

$response = Paytabs::make()
    ->queryTransaction('TST2422201903602');

dd($response);

Troubleshooting

Common Issues

  • Invalid Credentials: Ensure that your profile_id and server_key in the configuration file are correct.
  • Unsupported Region: Double-check that the region in your configuration file is valid and supported by PayTabs.
  • Transaction Failure: Verify the transaction data (e.g., cart amount, customer details) to ensure it meets PayTabs' requirements.

If you encounter other issues, refer to the PayTabs API Documentation for more details.

Testing

Soon...

Contribution

Contributions are welcome! If you’d like to contribute to this package, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Write your code and ensure it is well-documented.
  4. Submit a pull request with a clear description of your changes.

License

This package is open-sourced software licensed under the MIT license.

granada-pride/paytabs 适用场景与选型建议

granada-pride/paytabs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.26k 次下载、GitHub Stars 达 3, 最近一次更新时间为 2024 年 08 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 granada-pride/paytabs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 granada-pride/paytabs 我们能提供哪些服务?
定制开发 / 二次开发

基于 granada-pride/paytabs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.26k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-08-10