承接 ronmelkhior/coinpayments-ipn 相关项目开发

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

邮箱: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.36k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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