ronmelkhior/coinpayments-ipn 问题修复 & 功能扩展

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

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

ronmelkhior/coinpayments-ipn

最新稳定版本:v1.0.5

Composer 安装命令:

composer require ronmelkhior/coinpayments-ipn

包简介

Simple and straight forward Coinpayments IPN

README 文档

README

Coinpayments-IPN is a simple PHP package that lets you easily handle IPN requests from Coinpayments, without any hassle.

Disclaimer

At the moment, this package only supports the HTTP Auth IPN method in Coinpayments.

Usage

First of all, install the package via Composer:

composer require ronmelkhior/coinpayments-ipn

Then add in the IPN to your code like so:

<?php

use RonMelkhior\CoinpaymentsIPN\IPN;

$ipn = new IPN();

Once you initialize the IPN class, you need to setup the merchant ID & IPN secret with the setMerchantID and setIPNSecret methods.

<?php

use RonMelkhior\CoinpaymentsIPN\IPN;

$ipn = new IPN();
$ipn->setMerchantID('your-id-here')
    ->setIPNSecret('your-secret-here');

Then, you can validate the IPN with the validate method, which you need to provide your $_POST and $_SERVER arrays to.

<?php

use RonMelkhior\CoinpaymentsIPN\IPN;

$ipn = new IPN();
$ipn->setMerchantID('your-id-here')
    ->setIPNSecret('your-secret-here');

try {
    if ($ipn->validate($_POST, $_SERVER)) {
        // Payment was successful, verify vars such as the transaction ID/email and process it.
    } else {
        // IPN worked, but the payment is pending.
    }
} catch (RonMelkhior\CoinpaymentsIPN\Exceptions\InvalidRequestException $e) {
    // The IPN data was not valid to begin with (missing data, invalid IPN method).
} catch (RonMelkhior\CoinpaymentsIPN\Exceptions\InsufficientDataException $e) {
    // Sufficient data provided, but either the merchant ID or the IPN secret didn't match.
} catch (RonMelkhior\CoinpaymentsIPN\Exceptions\FailedPaymentException $e) {
    // IPN worked, but the payment has failed (PayPal refund/cancelled/timed out).
}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固