定制 tcgunel/omnipay-moka 二次开发

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

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

tcgunel/omnipay-moka

最新稳定版本:v2.0.0

Composer 安装命令:

composer require tcgunel/omnipay-moka

包简介

Omnipay extension for Moka

README 文档

README

Moka gateway for the Omnipay PHP payment processing library

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

Installation

composer require tcgunel/omnipay-moka

Usage

Gateway Setup

use Omnipay\Omnipay;

$gateway = Omnipay::create('Moka');
$gateway->setMerchantId('YOUR_DEALER_CODE');
$gateway->setMerchantUser('YOUR_USERNAME');
$gateway->setMerchantPassword('YOUR_PASSWORD');
$gateway->setTestMode(true); // uses https://service.refmoka.com

Non-3D Purchase

$response = $gateway->purchase([
    'amount'        => '1.50',
    'currency'      => 'TRY',
    'transactionId' => 'ORDER-12345',
    'installment'   => 1,
    'clientIp'      => '127.0.0.1',
    'card'          => [
        'firstName'   => 'John',
        'lastName'    => 'Doe',
        'number'      => '5269111122223332',
        'expiryMonth' => '01',
        'expiryYear'  => '2030',
        'cvv'         => '123',
    ],
])->send();

if ($response->isSuccessful()) {
    $transactionReference = $response->getTransactionReference(); // VirtualPosOrderId
}

3D Secure Purchase

$response = $gateway->purchase([
    'amount'        => '1.50',
    'currency'      => 'TRY',
    'transactionId' => 'ORDER-12345',
    'installment'   => 1,
    'clientIp'      => '127.0.0.1',
    'secure'        => true,
    'returnUrl'     => 'https://yoursite.com/callback',
    'card'          => [
        'firstName'   => 'John',
        'lastName'    => 'Doe',
        'number'      => '5269111122223332',
        'expiryMonth' => '01',
        'expiryYear'  => '2030',
        'cvv'         => '123',
    ],
])->send();

if ($response->isRedirect()) {
    $response->redirect(); // redirects to Moka 3D page
}

Complete Purchase (3D callback)

$response = $gateway->completePurchase([
    'otherTrxCode'  => $_POST['OtherTrxCode'],  // orderNumber
    'trxCode'       => $_POST['trxCode'],        // transactionId
    'resultCode'    => $_POST['resultCode'] ?? null,
    'resultMessage' => $_POST['resultMessage'] ?? null,
])->send();

if ($response->isSuccessful()) {
    // Payment verified
}

Cancel (Void)

$response = $gateway->void([
    'virtualPosOrderId' => 'MOKA_ORDER_ID',
    'transactionId'     => 'ORDER-12345',
    'clientIp'          => '127.0.0.1',
])->send();

if ($response->isSuccessful()) {
    // Void successful
}

Refund

$response = $gateway->refund([
    'virtualPosOrderId' => 'MOKA_ORDER_ID',
    'transactionId'     => 'ORDER-12345',
    'amount'            => '9.99',
])->send();

if ($response->isSuccessful()) {
    // Refund successful
}

BIN Lookup

$response = $gateway->binLookup([
    'binNumber' => '526911',
])->send();

if ($response->isSuccessful()) {
    $creditType           = $response->getCreditType();           // e.g. "CreditCard"
    $maxInstallmentNumber = $response->getMaxInstallmentNumber(); // e.g. 12
}

Installment Query

$response = $gateway->installmentQuery([
    'binNumber'   => '526911',
    'amount'      => '100.00',
    'currency'    => 'TRY',
    'installment' => 3,
    'isThreeD'    => 0,
])->send();

if ($response->isSuccessful()) {
    $paymentAmount = $response->getPaymentAmount(); // total with commission
}

Endpoints

Environment URL
Test https://service.refmoka.com
Live https://service.moka.com

Authentication

Moka uses CheckKey-based authentication:

CheckKey = SHA256(DealerCode + "MK" + Username + "PD" + Password)

This is generated automatically by the gateway.

Currency

Omnipay uses ISO currency codes (TRY, USD, EUR, GBP). The gateway automatically maps TRY to Moka's TL format.

Testing

composer test

License

MIT

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固