承接 paytabs/php-sdk 相关项目开发

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

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

paytabs/php-sdk

Composer 安装命令:

composer require paytabs/php-sdk

包简介

Official PayTabs PHP SDK for Payment Gateway integrations

README 文档

README

Official PHP SDK for integrating with PayTabs Payment Gateway.

Requirements

  • PHP ^8.4
  • cURL extension enabled

Install

composer require paytabs/php-sdk:^3.0

Quick Start

<?php

use Paytabs\Sdk\Http\Http;
use Paytabs\Sdk\Paytabs;
use Paytabs\Sdk\Profile\ProfilesFactory;
use Paytabs\Sdk\Request\Payload\PayloadsFactory;
use Paytabs\Sdk\Request\RequestsFactory;
use Paytabs\Sdk\Enums\TranClass;
use Paytabs\Sdk\Enums\TranType;

$profile = ProfilesFactory::createUaeProfile(
	(int) getenv('PAYTABS_PROFILE_ID'),
	(string) getenv('PAYTABS_SERVER_KEY')
);

$payload = PayloadsFactory::hostedPage();
$payload
	->buildTransaction(TranType::Sale, TranClass::Ecom)
	->buildCart('order-1001', 'AED', 100.00, 'Order 1001')
	->buildHideShipping(true);

$request = RequestsFactory::paymentRequest($profile, $payload);

$http = (new Http())
	->setLogger(Paytabs::getLogger())
	->setRequest($request);

try {
	$response = $http->submit();
} catch (\Paytabs\Sdk\Exceptions\HttpRequestException $e) {
	// Transport failure or non-2xx response.
	throw $e;
}

if ($response->isFailure()) {
	$failure = $response->getFailure();
	echo $failure->code.' - '.$failure->message;
	exit;
}

if ($response->isRedirect()) {
	$redirect = $response->getRedirect();
	header('Location: '.$redirect->redirect_url);
	exit;
}

Security Notes

  • Do not log card data, CVV, full tokens, or full webhook signatures.
  • Store credentials in environment variables, not in repository files.
  • Always verify webhook signatures and reject invalid requests.

See webhook verification guide: docs/usage/Webhooks.md

Logging Configuration

The SDK logger can be configured with environment variables:

  • PAYTABS_LOG_PATH: Directory where SDK log files are stored.
    • Default: /var/log/paytabs-sdk/
    • Fallback: system temporary directory when the configured/default path is empty.
  • PAYTABS_LOG_BROWSER: Enables browser logger mode when set to true.
    • Default behavior uses file logger mode.

Example:

export PAYTABS_LOG_PATH="/var/log/paytabs-sdk"
export PAYTABS_LOG_BROWSER="false"

Documentation

Project Governance

Samples Setup

  1. Copy Samples/.env.sample to Samples/.env.
  2. Replace placeholder values with sandbox credentials.
  3. Run samples locally and expose callback URL when needed.

Development Commands

composer lint
composer test

Live gateway tests are opt-in only:

PAYTABS_RUN_LIVE_TESTS=1 composer test

Versioning

This SDK follows semantic versioning. Breaking changes are introduced only in major versions.

Support

For integration support, use PayTabs official support channels. For security vulnerabilities, report via the PayTabs Bug Bounty Program and follow SECURITY.md. Public issues are intended for reproducible SDK bugs and enhancement requests.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2026-06-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固