定制 avatec/omnipay-p24 二次开发

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

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

avatec/omnipay-p24

最新稳定版本:1.0

Composer 安装命令:

composer require avatec/omnipay-p24

包简介

Przelewy24 driver for the Omnipay payment processing library. Forked from ticketswap/omnipay-przelewy24

README 文档

README

Przelewy24 gateway for the Omnipay PHP payment processing library

Software License Build Status

Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 8.0+. This package implements Przelewy24 support for Omnipay.

For more information about the Przelewy24 API, take a look at the manual

Install

This gateway can be installed with Composer:

$ composer require avatec/omnipay-p24

Usage

The following gateways are provided by this package:

  • Przelewy24

Example - get payment link

require_once  __DIR__ . '/vendor/autoload.php';

use Omnipay\Omnipay;

/** @var \Omnipay\Przelewy24\Gateway $gateway */
$gateway = Omnipay::create('Przelewy24');

$gateway->initialize([
    'merchantId' => 'YOUR MERCHANT ID HERE',
    'posId'      => 'YOUR POS ID HERE',
    'crc'        => 'YOUR CRC KEY HERE',
    'testMode'   => true,
]);

$params = array(
    'sessionId' => 2327398739,
    'amount' => 12.34,
    'currency' => 'PLN',
    'description' => 'Payment test',
    'returnUrl' => 'www.your-domain.nl/return_here',
    'notifyUrl' => 'www.your-domain.nl/notify_here',
    'card' => array(
        'email' => 'info@example.com',
        'name' => 'My name',
        'country' => 'NL',
    ),
);

$response = $gateway->purchase($params)->send();

if ($response->isSuccessful()) {
    $response->redirect();
} else {
    echo 'Failed';
}

Optionally you can specify the payment channels allowed adding the 'channel' parameter in the Gateway initialization call.

$gateway->initialize([
    //[...]
    'channel' => Gateway::P24_CHANNEL_CC,
]);
    

For a list of all the supported values for 'Channel' you can read the przelewy24 documentation

Example - validate payment (notifyUrl)

require_once  __DIR__ . '/vendor/autoload.php';

use Omnipay\Omnipay;

/** @var \Omnipay\Przelewy24\Gateway $gateway */
$gateway = Omnipay::create('Przelewy24');

$gateway->initialize([
    'merchantId' => 'YOUR MERCHANT ID HERE',
    'posId'      => 'YOUR POS ID HERE',
    'crc'        => 'YOUR CRC KEY HERE',
    'testMode'   => true,
]);

$params = array(
    'sessionId' => 2327398739,
    'amount' => 12.34,
    'transactionId' => 12345678,
    'method' => 63,
    'currency' => 'PLN',
    'statement' => 'p24-H00-B00-J00',
    'sign' => 'sign hashed'
);

$response = $gateway->completePurchase($params)->send();

if ($response->isSuccessful()) {
    echo 'Success';
} else {
    echo 'Failed';
}

Support

If you are having general issues with Omnipay, we suggest posting on Stack Overflow. Be sure to add the omnipay tag so it can be easily found.

If you want to keep up to date with release anouncements, discuss ideas for the project, or ask more detailed questions, there is also a mailing list which you can subscribe to.

If you believe you have found a bug, please report it using the GitHub issue tracker, or better yet, fork the library and submit a pull request.

Testing

$ composer test

Security

If you discover any security related issues, please email info@ticketswap.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-29