承接 ajaz/payumoney-payment-gateway-php 相关项目开发

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

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

ajaz/payumoney-payment-gateway-php

Composer 安装命令:

composer require ajaz/payumoney-payment-gateway-php

包简介

A simple PayUMoney payment gateway integration library

README 文档

README

A simple PayUMoney payment gateway integration library

PayUMoney API for PHP

create a merchant account on PayUMoney site

Simple library for accepting payments via PayUMoney.

Installation

The recommended way to install this library Composer:

composer require ajaz/payumoney-payment-gateway-php

Usage

You'll find a minimal usage example below.

Initialize purchase

<?php
// purchase.php

use PaymentGateway\PayUmoney\PayUMoney;

require 'vendor/autoload.php';

$payumoney = new PayUMoney(array(
    'merchantId' => 'YOUR_MERCHANT_ID',
    'secretKey'  => 'YOUR_SECRET_KEY',
    'testMode'   => true
));

// All of these parameters are required!
$params = [
    'txnid'       => 'TXN65876798779',
    'amount'      => 100.00,
    'productinfo' => 'Buy a Sunglasses',
    'firstname'   => 'Garry',
    'email'       => 'jack@example.com',
    'phone'       => '1234567890',
    'surl'        => 'http://localhost/payumoney-payment-gateway-php/return.php',
    'furl'        => 'http://localhost/payumoney-payment-gateway-php/return.php',
    'udf1'        =>  'USER ID' //optional
];

// Redirects to PayUMoney
$data = $payumoney->initializePurchase($params);

$output = sprintf('<form id="payment_form" method="POST" action="%s">', $payumoney->getServiceUrl());

        foreach ($data as $key => $value) {
            $output .= sprintf('<input type="hidden" name="%s" value="%s" />', $key, $value);
        }

        $output .= '<input type="hidden" name="service_provider" value="payu_paisa" size="64" />';

        $output .= '<div id="redirect_info" style="display: none">Redirecting...</div>
                <input id="payment_form_submit" type="submit" value="Proceed to PayUMoney" />
            </form>
            <script>
                document.getElementById(\'redirect_info\').style.display = \'block\';
                document.getElementById(\'payment_form_submit\').style.display = \'none\';
                document.getElementById(\'payment_form\').submit();
            </script>';
 echo $output;

Finalize purchase

<?php
// return.php

use PaymentGateway\PayUmoney\PayUMoney;
use PaymentGateway\PayUmoney\PurchaseResult;

require 'vendor/autoload.php';

$payumoney = new PayUMoney([
    'merchantId' => 'YOUR_MERCHANT_ID',
    'secretKey'  => 'YOUR_SECRET_KEY',
    'testMode'   => true
]);

$result = $payumoney->completePurchase($_POST);

if ($result->checksumIsValid() && $result->getStatus() === PurchaseResult::STATUS_COMPLETED) {
  print 'Payment was successful.';
} else {
  print 'Payment was not successful.';
}

The PurchaseResult has a few more methods that might be useful:

$result = $payumoney->completePurchase($_POST);

// Returns Complete, Pending, Failed or Tampered
$result->getStatus(); 

// Returns an array of all the parameters of the transaction
$result->getParams();

// Returns the ID of the transaction
$result->getTransactionId();

// Returns true if the checksum is correct
$result->checksumIsValid();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-11-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固