定制 pmgw/payment-gateway-php7-sdk 二次开发

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

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

pmgw/payment-gateway-php7-sdk

Composer 安装命令:

composer require pmgw/payment-gateway-php7-sdk

包简介

Nevogate Payment Gateway SDK

README 文档

README

Repository github.com/pmgw-hu/payment-gateway-php7-sdk (pmgw/payment-gateway-php7-sdk) is abandoned, you should avoid using it.

Use https://github.com/nevogate/payment-gateway-sdk-php (nevogate/payment-gateway-sdk) instead.

Nevogate Payment Gateway SDK - PHP

Version

5.2.0

Requirements

  • PHP 7.2
  • PHP cURL extension
  • PHP OpenSSL extension
  • PHP JSON extension

Installation

Nevogate Payment Gateway is available at packagist.org, so you can use composer to download this library.

{
    "require": {
        "nevogate/payment-gateway-sdk": "^5.1@stable"
    }
}

or run

composer require nevogate/payment-gateway-sdk

Technical documentation

https://docs.nevogate.com/

Source code

https://github.com/nevogate/payment-gateway-sdk-php

Example usage

Basic configuration

$config = new \Nevogate\PaymentGateway\Config();
$config->storeName = "example store name";
$config->apiKey = "ExamPleApiKey";
$config->encryptPublicKey = "publicKeyGoesHere";
$config->testMode = true;

$paymentGateway = new \Nevogate\PaymentGateway($config);

Init request

$init = new \Nevogate\PaymentGateway\Request\Init();
$init->setProviderName(\Nevogate\PaymentGateway::PROVIDER_CIB) // the chosen payment method
    ->setResponseUrl('http://your.companys.webshop.url/payment_gateway_response') // callback url
    ->setAmount(1234)
    ->setCurrency('HUF')
    ->setOrderId('ORD-1234') // your custom order id
    ->setUserId('USER-1234') // your custom user id
    ->setLanguage('HU');

$response = $paymentGateway->send($init);

Start request

if (!$response->ResultCode == "SUCCESSFUL" || !$response->TransactionId) {
    // handle error here
}

$paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\Start())->setTransactionId($response->TransactionId)
    );

Result request

$result = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\Result())->setTransactionId($_GET['TransactionId'])
    );

Details request

$details = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\Details())->setTransactionId($_GET['TransactionId'])
    );

Close request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\Close())->setTransactionId($transactionId)
    );

Refund request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\Refund())
            ->setTransactionId($transactionId)
            ->setAmount(100)
    );

Payout request

$payout = new \Nevogate\PaymentGateway\Request\Payout();
$payout->setPayoutType(\Nevogate\PaymentGateway::PAYOUT_TYPE_FUNDS_DISBURSEMENT)
    ->setReferenceTransactionId("783593c87fee4d372f47f53840028682")
    ->setAmount(200)
    ->setOrderId("NEVOGATE-TEST-ORDER-REG") // your custom order id
    ->setAdditionalMessage("NEVOGATE-TEST-PAYOUT-MESSAGE");

$response = $paymentGateway->send($payout);

Get payment registrations request

$response = $paymentGateway->send(
    (new \Nevogate\PaymentGateway\Request\GetPaymentRegistrations())
        ->setProviderName(\Nevogate\PaymentGateway::PROVIDER_BARION2)
        ->setUserId('User1')
    );

Get payment registration request

$response = $paymentGateway->send(
    (new \Nevogate\PaymentGateway\Request\GetPaymentRegistration())
        ->setTransactionId($transactionId)
);

Cancel payment registration request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\CancelPaymentRegistration())->setTransactionId($transactionId)
    );

Cancel all payment registrations request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\CancelAllPaymentRegistrations())
            ->setProviderName(\Nevogate\PaymentGateway::PROVIDER_BORGUN2)
            ->setUserId('userId')
    );

Init Recurring Payment - InitRP

$initRP = new \Nevogate\PaymentGateway\Request\InitRP();
$initRP->setReferenceTransactionId("783593c87fee4d372f47f53840028682")
    ->setResponseUrl("http://your.companys.webshop.url/payment_gateway_response") // callback url
    ->setAmount(200)
    ->setCurrency("HUF")
    ->setOrderId("NEVOGATE-TEST-ORDER-REG") // your custom order id
    ->setUserId("NEVOGATE-TEST-USER-REG");

$response = $paymentGateway->send($initRP);

StartRP request

if (!$response->ResultCode == "SUCCESSFUL" || !$response->TransactionId) {
    // handle error here
}

$result = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\StartRP())->setTransactionId($response->TransactionId)
    );

Create Payment Link - PaymentLinkCreate

$paymentLink = new \Nevogate\PaymentGateway\Request\PaymentLinkCreate();
$paymentLink->setProviderName(\Nevogate\PaymentGateway::PROVIDER_CIB) // the chosen payment method
    ->setAmount(1234)
    ->setCurrency('HUF')
    ->setOrderId('ORD-1234') // your custom order id
    ->setUserId('USR-1234') // your customer id
    ->setLanguage('HU');

$response = $paymentGateway->send($paymentLink);

Cancel request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\PaymentLinkCancel())->setPaymentLinkName($paymentLinkName)
    );

Details request

$response = $paymentGateway->send(
        (new \Nevogate\PaymentGateway\Request\PaymentLinkDetails())->setPaymentLinkName($paymentLinkName)
    );

Info data

Basic usage

$infoObject = new \Nevogate\PaymentGateway\Data\Info();

$infoCustomerGeneral = new \Nevogate\PaymentGateway\Data\Info\Customer\InfoCustomerGeneral();
$infoCustomerGeneral->setFirstName("John")
    ->setLastName("Doe")
    ->setEmail("test@testmail.com");

$infoObject->setObject($infoCustomerGeneral); //add $infoCustomerGeneral to $infoObject
 
$infoShipping = new \Nevogate\PaymentGateway\Data\Info\Order\InfoOrderShippingData();
$infoShipping->setFirstName("John")
    ->setLastName("Doe")
    ->setEmail("test@testmail.com")
    ->setPhoneCc("36")
    ->setPhone("801234567")
    ->setCity("Budapest");

$infoObject->setObject($infoShipping); //add $infoShipping to $infoObject
 
$infoOrderProductItem = new \Nevogate\PaymentGateway\Data\Info\Order\InfoOrderProductItem();
$infoOrderProductItem->setSku("PMG055005")
    ->setName("Product11")
    ->setQuantity("10")
    ->setQuantityUnit("db")
    ->setUnitPrice("22.00")
    ->setImageUrl("http://webhsop/product11.jpg")
    ->setDescription("Product11 desc.");

$infoObject->setObject($infoOrderProductItem); //add $infoOrderProductItem to $infoObject
 
$infoOrderProductItem = new \Nevogate\PaymentGateway\Data\Info\Order\InfoOrderProductItem();
$infoOrderProductItem->setSku("PMG055008")
    ->setName("Product12")
    ->setQuantity("10")
    ->setQuantityUnit("db")
    ->setUnitPrice("22.00")
    ->setImageUrl("http://webhsop/product12.jpg")
    ->setDescription("Product12 desc.");

$infoObject->setObject($infoOrderProductItem); //add $infoOrderProductItem to $infoObject

Init

...
    $init->setInfo($infoObject);
...

Payout

...
    $payout->setInfo($infoObject);
...

InitRP

...
    $initRP->setInfo($infoObject);
...

Payment Link

...
    $paymentLink->setInfo($infoObject);
...

pmgw/payment-gateway-php7-sdk 适用场景与选型建议

pmgw/payment-gateway-php7-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18.75k 次下载、GitHub Stars 达 6, 最近一次更新时间为 2024 年 07 月 03 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 pmgw/payment-gateway-php7-sdk 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-03