kajuzi/omnipay-tazapay 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

kajuzi/omnipay-tazapay

最新稳定版本:0.0.1

Composer 安装命令:

composer require kajuzi/omnipay-tazapay

包简介

Tazapay driver for the Omnipay payment processing library

README 文档

README

Caution: This package is yet to be properly tested. Do your own testing before using it in production!

Tazapay driver for the Omnipay PHP payment processing library

Latest Version on Packagist Software License Total Downloads

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP. This package implements Tazapay support for Omnipay.

Installation

Omnipay is installed via Composer. To install, simply require league/omnipay and kajuzi/omnipay-tazapay with Composer:

composer require league/omnipay kajuzi/omnipay-tazapay

Basic Usage

The following gateways are provided by this package:

  • Tazapay

For general usage instructions, please see the main Omnipay repository.

Initialize Gateway

use Omnipay\Omnipay;

$gateway = Omnipay::create('Tazapay');
$gateway->setApiKey('your-api-key');
$gateway->setApiSecret('your-api-secret');
// If you intend to use the sandbox environment. 
$gateway->setTestMode(true);

The package has not been fully tested yet, so it's set to default to test mode.

Please do NOT hard-code your API credentials. Use the .env file for that

Create a Customer

$response = $gateway->createCustomer([
    'card' => [
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john.doe@example.com',
        'country' => 'SG',
        'phone' => '67854321',
        'phoneExtension' => '65',
    ],
    'referenceId' => 'customer-123',
])->send();

if ($response->isSuccessful()) {
    $customerId = $response->getTransactionReference();
    echo "Customer created with ID: " . $customerId;
} else {
    echo "Error: " . $response->getMessage();
}

Create a Checkout Session (Purchase)

$response = $gateway->purchase([
    'amount' => '10.00',
    'currency' => 'USD',
    'description' => 'Test Purchase',
    'transactionId' => 'order-123',
    'returnUrl' => 'https://example.com/return',
    'cancelUrl' => 'https://example.com/cancel',
    'webhookUrl' => 'https://example.com/webhook',
    'card' => [
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john.doe@example.com',
        'country' => 'SG',
    ],
])->send();

if ($response->isSuccessful() && $response->isRedirect()) {
    // Redirect to Tazapay hosted checkout page
    $response->redirect();
} else {
    echo "Error: " . $response->getMessage();
}

Fetch Transaction Details

$response = $gateway->fetchTransaction([
    'transactionReference' => 'chk_cirsp2sl4ar024j0akj0',
])->send();

if ($response->isSuccessful()) {
    $data = $response->getData();
    echo "Transaction status: " . $response->getPaymentStatus();
} else {
    echo "Error: " . $response->getMessage();
}

Refund a Transaction

$response = $gateway->refund([
    'transactionReference' => 'chk_cirsp2sl4ar024j0akj0',
    'amount' => '10.00',
    'currency' => 'USD',
    'reason' => 'Customer requested refund',
])->send();

if ($response->isSuccessful()) {
    $refundId = $response->getTransactionReference();
    echo "Refund created with ID: " . $refundId;
} else {
    echo "Error: " . $response->getMessage();
}

Void/Cancel a Transaction

$response = $gateway->void([
    'transactionReference' => 'chk_cirsp2sl4ar024j0akj0',
])->send();

if ($response->isSuccessful()) {
    echo "Transaction cancelled successfully";
} else {
    echo "Error: " . $response->getMessage();
}

Fetch Available Payment Methods

$response = $gateway->fetchPaymentMethods([
    'amount' => '10.00',
    'currency' => 'USD',
    'customerCountry' => 'SG',
])->send();

if ($response->isSuccessful()) {
    $paymentMethods = $response->getData()['payment_methods'];
    foreach ($paymentMethods as $method) {
        echo $method['display_name'] . " (" . $method['type'] . ")\n";
    }
} else {
    echo "Error: " . $response->getMessage();
}

Support

If you are struggling with your integration, please feel free to reach out at on kajuzi.co.za. Please note, you may be billed for certain services.

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you believe you have found a bug, please report it using the Gitlab issue tracker, or better yet, fork the library and submit a merge request.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-10