yellowmelon/targetpay 问题修复 & 功能扩展

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

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

yellowmelon/targetpay

Composer 安装命令:

composer require yellowmelon/targetpay

包简介

TargetPay PHP SDK

README 文档

README

With this (namespaced) SDK you can easily make the calls to TargetPay for all the payment methods that are provided.

Required: PHP 5.3+

Installation

  • Copy the files in /lib to your webserver.

Usage

First register the autoloader. If your framework already has an autoloader you might not need to use this. Use the proper route to the autoload file

require_once __DIR__.'/../lib/TargetPay/autoload.php';

Include the TargetPay namespace:

use \TargetPay as TargetPay;

Now start the payment by calling:

$startPaymentResult = TargetPay\Transaction::model("Ideal")
    ->rtlo(121455)
    ->amount(1000)
    ->description('Test payment')
    ->returnUrl('http://www.test.nl/success')
    ->cancelUrl('http://www.test.nl/canceled')
    ->reportUrl('http://www.test.nl/report')
    ->bank('0021')
    ->start();	 	

You can check the result. $startPaymentResult->status will be true in case of success. If not startPaymentResult->status will have the error message.

If all is OK, redirect to the bank:

Header ("Location: ".$startPaymentResult->url);

After payment the reportUrl will be called by TargetPay, passing amongst others the transaction ID . See the TargetPay documentation for more information.

The script behind this report URL has to check the validity of the report, thus checking the actual payment.

This is done by calling (after including the autoloader and use statement):

		$checkPaymentResult = TargetPay\Transaction::model($method)
		 	->rtlo(121455)
		 	->txid($startPaymentResult->txid)
		 	->test(false)
		 	->check();

Check the results in $checkPaymentResult for more information about the payment. Most important: $checkPaymentResult = true indicates a succesful payment. Save the result of the payment in your database.

When the customer paid, he will be redirected to the Return URL. If not, he is redirected to the Cancel URL.

Payment methods

Currently the following payment methods are implemented. See their classes (in parentheses) under /lib/TargetPay/Methods for their specifics like minimum/maximum amounts and specific properties:

  • iDEAL (Methods_Ideal)
  • Bancontact/Mister Cash (Methods_MisterCash)
  • Sofort Banking, former DirectEbanking (Methods_Sofort)
  • Paysafecard, former Wallie (Methods_Paysafecard)
  • Visa/Mastercard (Methods_Creditcard)

Notes

  • The initial call described above is slightly simplified. For iDEAL you first need to ask the customer to select his bank and pass it with bank(). For Sofort you specify country(), the options are listed in the documentation. Other payment methods do not need these parameters.
  • Do not forget to enter your own layoutcode. 121455 is just a testcode.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-2.0
  • 更新时间: 2014-10-26

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固