定制 and/w1-api 二次开发

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

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

and/w1-api

最新稳定版本:v0.5

Composer 安装命令:

composer require and/w1-api

包简介

W1 API

README 文档

README

The workflow constists from 2 steps:

  1. Redirect user to W1 payment page
  2. Check the payment

Here is code samples for each step:

1-st step:

$api = new W1\PaymentAPI('merchantId', 'secretKey');
echo $api->getFormHTMLDocument($api->createPaymentForm()
	->setPaymentId(uniqid())
	->setCultureId('ru' == $this->getLastLocale() ? 
  	  W1\Form\PaymentForm::LANG_RU : 
  	  W1\Form\PaymentForm::LANG_EN
	 )
	->setAmount(2.99)
	->setCurrencyId(W1\Form\PaymentForm::CURRENCY_USD)
	->setDescription('Оплата за что-то')
	->setSuccessUrl($this->get_page_url('buy_method_w1_callback')) // to redirect user
	->setFailUrl($this->get_page_url('')) // to redirect user

2-nd step:

$api = new W1\PaymentAPI('merchantId', 'secretKey');
if (!empty($_POST))
{
	if (!$api->createPaymentForm()->isPaymentAccepted($_POST))
	{
		$this->logger()->log_exception('Error:W1', 'Wrong confirmation: ' . json_encode($_POST), __FILE__, __LINE__);
		echo $api->getRetryResponse('Wrong confirmation');
	}
	else
	{
		$this->buy_dlc_finalize();
		echo $api->getSuccessResponse();
	}
}
else $this->redirect_to_relative('buy_method_w1');

And that's all! You're wonderful! :)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-2-Clause
  • 更新时间: 2015-01-18