定制 tcgunel/omnipay-yapikredi 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tcgunel/omnipay-yapikredi

Composer 安装命令:

composer require tcgunel/omnipay-yapikredi

包简介

Omnipay extension for Yapi Kredi (Posnet)

README 文档

README

Yapikredi (Posnet) gateway for the Omnipay PHP payment processing library.

Latest Stable Version Total Downloads License

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP. This package implements Yapikredi (Posnet) support for Omnipay.

Installation

composer require tcgunel/omnipay-yapikredi

Requirements

  • PHP >= 8.0
  • ext-simplexml
  • ext-dom

Supported Methods

Method Description
purchase() Non-3D direct sale via Posnet XML API
enrolment() 3D Secure enrolment (oosRequestData + redirect)
completePurchase() 3D Secure completion (oosResolveMerchantData + oosTranData)

Not Implemented

The following features are not available through the CP.VPOS Posnet integration:

  • Cancel/Refund: Not supported (returns error). Use the Yapikredi merchant panel instead.
  • Sale Query: Not supported through this API.
  • Installment/BIN Query: Not available through Posnet.

Credentials

Parameter Description
merchantId Merchant ID (mid)
terminalId Terminal ID (tid)
posnetId Posnet ID (merchant password)
storeKey Store key for 3D Secure hash generation

Endpoints

Environment API URL 3D URL
Test https://setmpos.ykb.com/PosnetWebService/XML https://setmpos.ykb.com/3DSWebService/YKBPaymentService
Production https://posnet.yapikredi.com.tr/PosnetWebService/XML https://posnet.yapikredi.com.tr/3DSWebService/YKBPaymentService

Test panel: https://setmpos.ykb.com/PosnetF1/Login.jsp

Usage

Non-3D Direct Sale (purchase)

use Omnipay\Omnipay;

$gateway = Omnipay::create('Yapikredi');

$gateway->setMerchantId('6706598320');
$gateway->setTerminalId('67005551');
$gateway->setPosnetId('1010028724');
$gateway->setTestMode(true);

$response = $gateway->purchase([
    'amount'        => '1.50',
    'currency'      => 'TRY',
    'transactionId' => 'ORDER-001',
    'installment'   => 1,
    'card'          => [
        'number'      => '4506349116608409',
        'expiryMonth' => '03',
        'expiryYear'  => '2030',
        'cvv'         => '000',
    ],
])->send();

if ($response->isSuccessful()) {
    echo "Transaction Reference: " . $response->getTransactionReference();
} else {
    echo "Error: " . $response->getMessage();
    echo "Code: " . $response->getCode();
}

3D Secure Payment (enrolment + completePurchase)

Step 1: Enrolment (redirect to 3D page)

$response = $gateway->enrolment([
    'amount'        => '1.50',
    'currency'      => 'TRY',
    'transactionId' => 'ORDER-001',
    'installment'   => 1,
    'returnUrl'     => 'https://example.com/payment/callback',
    'storeKey'      => '10,10,10,10,10,10,10,10',
    'card'          => [
        'number'      => '4506349116608409',
        'expiryMonth' => '03',
        'expiryYear'  => '2030',
        'cvv'         => '000',
    ],
])->send();

if ($response->isRedirect()) {
    $response->redirect(); // Redirects to 3D Secure page
} else {
    echo "Error: " . $response->getMessage();
}

Step 2: Complete Purchase (after 3D callback)

// In your callback URL handler:
$response = $gateway->completePurchase([
    'amount'         => '1.50',
    'currency'       => 'TRY',
    'transactionId'  => 'ORDER-001',
    'storeKey'       => '10,10,10,10,10,10,10,10',
    'bankPacket'     => $_POST['BankPacket'],
    'merchantPacket' => $_POST['MerchantPacket'],
    'sign'           => $_POST['Sign'],
])->send();

if ($response->isSuccessful()) {
    echo "Payment successful!";
    echo "Transaction Reference: " . $response->getTransactionReference();
} else {
    echo "Payment failed: " . $response->getMessage();
}

Posnet Protocol Notes

  • Amount Format: Multiplied by 100, no decimals (e.g., 1.50 TRY = "150")
  • Currency Codes: TRY = "TL", USD = "US", EUR = "EU"
  • Order ID: Padded with leading zeros to 24 characters
  • Expiry Date: YYMM format (e.g., March 2030 = "3003")
  • Installment: "00" for single payment, "02"-"12" for installments
  • 3D Secure Hash: SHA256 based. First hash: SHA256(storeKey + ";" + terminalId), MAC: SHA256(xid + ";" + amount + ";" + currency + ";" + mid + ";" + firstHash)

Testing

composer test

License

MIT License. See LICENSE for details.

tcgunel/omnipay-yapikredi 适用场景与选型建议

tcgunel/omnipay-yapikredi 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 03 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「payment」 「gateway」 「omnipay」 「posnet」 「3d secure」 「sanal pos」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 tcgunel/omnipay-yapikredi 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-23