izal/tap-payment-php 问题修复 & 功能扩展

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

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

izal/tap-payment-php

最新稳定版本:0.0.3

Composer 安装命令:

composer require izal/tap-payment-php

包简介

Php SDK for Tap Payment Gateway

README 文档

README

Packagist License Build Status

This is a package to integrate Tap Payments with Php.

Documentation

Installation

Require this package with composer:

composer require izal/tap-payment-php

Usage:

$config =
    [
        'ApiKey' => '1tap7',
        'UserName' => 'test',
        'Password' => 'test',
        'MerchantID' => '1014',
        'ErrorURL' => 'http://test.com/error-url'; // optional. default(NULL)
        'PaymentOption' = 'KNET'; // optional. default (ALL)
        'AutoReturn' = 'N'; // optional. default (Y)
        'CurrencyCode' = 'KWD'; // optional. default (KWD)
        'LangCode' = 'EN'; // optional. default(AR)
    ];

/**
*
* set the products that has to be purchased by the customer
*
* required fields (
*     Quantity, 
*     TotalPrice,
*     UnitName,
*     UnitDesc,
*     UnitPrice
* )
* 
* optional fields (
*    ImgUrl,
*    VndID
* )
* 
* note that you dont need to pass currency code in products list, as you are already passing it in the config.
* 
*/

$products =
    [
        [
            'Quantity' => '1',
            'TotalPrice' => '500',
            'UnitName' => 'Product Name',
            'UnitDesc' => 'Product Description',
            'UnitPrice' => '500',
        ],
        [
            'Quantity' => '2',
            'TotalPrice' => '300',
            'UnitName' => 'Product Name',
            'UnitDesc' => 'Product Description',
            'UnitPrice' => '150',
        ]
    ];

$customer =
    [
        'Email' => 'customer@email.com',
        'Name' => 'Awesome Customer',
        'Mobile' => '9999999',
    ];

// by default the package sets gateway to 'ALL', however, you can pass the below method if you need to set the gateway to other available options (KNET,VISA,MASTER,AMEX) 

// optional
$gateway = ['Name' => 'KNET'];

$merchant =
    [
        'ReturnURL' => 'http://test.com/payment/returnurl',
        'ReferenceID' => uniqid(),
    ];

$billing = new IZaL\Tap\TapBilling($config);

$billing->setProducts($products);
$billing->setCustomer($customer);
$billing->setGateway($gateway);
$billing->setMerchant($merchant);

// request for payment url

try {

    $paymentRequest = $billing->requestPayment();

    $response = $paymentRequest->response->getRawResponse();

    $paymentURL = $response->PaymentURL;

    
    // With the response object, you can redirect the user to the payment page
    
    // redirect url
    $paymentURL = $response->PaymentURL;
    
    // reference id
    $paymentReferenceID = $response->ReferenceID;

} catch (\Exception $e) {

    // var_dump($e->getMessage());
    // do something with the error

}

read the official tap documentation to know all the details of the response object

统计信息

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

GitHub 信息

  • Stars: 5
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-04