upgradelabs/ifthenpay 问题修复 & 功能扩展

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

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

upgradelabs/ifthenpay

最新稳定版本:2.0.0

Composer 安装命令:

composer require upgradelabs/ifthenpay

包简介

Laravel package for Ifthenpay API integration (Multibanco, MBWay, Credit Card, Google Pay, Apple Pay, Refunds)

README 文档

README

This package provides an easy integration with the Ifthenpay API for Laravel projects.

Version compatibility

Package version Laravel versions supported
^1.0 8.x, 9.x, 10.x
^2.0 11.x, 12.x

Installation

Choose the right version for your project:

# Laravel 8–10
composer require upgradelabs/ifthenpay:^1.0

# Laravel 11–12
composer require upgradelabs/ifthenpay:^2.0

Publish the configuration file:

php artisan vendor:publish --provider="Upgradelabs\Ifthenpay\IfthenpayServiceProvider" --tag="config"

Set your API keys in your .env file:

IFTHENPAY_SANDBOX=true
IFTHENPAY_MB_KEY=MBK-xxxxxxxx
IFTHENPAY_MBWAY_KEY=MBWAY-xxxxxxxx
IFTHENPAY_CCARD_KEY=CCARD-xxxxxxxx
IFTHENPAY_GATEWAY_KEY=GWK-xxxxxxxx
IFTHENPAY_GOOGLE_KEY=GOOGLE-xxxxxxxx
IFTHENPAY_APPLE_KEY=APPLE-xxxxxxxx
IFTHENPAY_BACKOFFICE_KEY=BACKOFFICE-xxxxxxxx

Usage

Use the Ifthenpay facade for all operations:

use Ifthenpay;

// Create Multibanco Reference
$response = Ifthenpay::createMultibancoReference([
    'orderId' => 'order-1234',
    'amount' => '123.45',
    'description' => 'Order description',
    'url' => 'https://example.com',
    'expiryDays' => 3,
]);

// Initiate MB WAY payment
$response = Ifthenpay::createMbwayPayment([
    'orderId' => 'order-1234',
    'amount' => '123.45',
    'mobileNumber' => '912345678',
]);

// Check MB WAY payment status
$status = Ifthenpay::getMbwayStatus($response['RequestId']);

// Initialize Credit Card payment
$response = Ifthenpay::initCreditCardPayment([
    'orderId'    => 'order-1234',
    'amount'     => '123.45',
    'successUrl' => 'https://example.com/success',
    'errorUrl'   => 'https://example.com/error',
    'cancelUrl'  => 'https://example.com/cancel',
    'language'   => 'en',
]);

// Create Google Pay payment
$response = Ifthenpay::createGooglePayPayment([
    'id'          => 'order-1234',
    'amount'      => '123.45',
    'description' => 'Order description',
    'lang'        => 'en',
    'expiredate'  => '20250101',
    'btnCloseUrl'    => 'https://example.com/close',
    'btnCloseLabel'  => 'Close',
    'success_url'    => 'https://example.com/success',
    'error_url'      => 'https://example.com/error',
    'cancel_url'     => 'https://example.com/cancel',
]);

// Create Apple Pay payment
$response = Ifthenpay::createApplePayPayment([
    'id'     => 'order-1234',
    'amount' => '123.45',
]);

// Issue a refund
$response = Ifthenpay::refund('request-id-123', '50.00');

Testing

Run the tests with:

vendor/bin/phpunit

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-28