承接 laraditz/2c2p 相关项目开发

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

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

laraditz/2c2p

Composer 安装命令:

composer require laraditz/2c2p

包简介

Simple laravel package for 2C2P Payment Gateway

关键字:

README 文档

README

Latest Version on Packagist Total Downloads License

Simple laravel package for 2C2P Payment Gateway.

Installation

You can install the package via composer:

composer require laraditz/2c2p

Before Start

Configure your variables in your .env (recommended) or you can publish the config file and change it there.

2C2P_MERCHANT_ID=<your_merchant_id_here>
2C2P_MERCHANT_SECRET=<your_merchant_secret_key_here>
2C2P_CURRENCY_CODE=<your_default_currency_code>
2C2P_SANDBOX_MODE=true # true or false for sandbox mode

(Optional) You can publish the config file via this command:

php artisan vendor:publish --provider="Laraditz\Twoc2p\Twoc2pServiceProvider" --tag="config"

Run the migration command to create the necessary database table.

php artisan migrate

Available Methods

Below are all methods available under this package.

Method name Description
createPayment() Create a new payment and get payment URL.
paymentInquiry() Inquire on payment details.
encodeJWT() Encode content based on 2c2p rules.
decodeJWT() Decode content based on 2c2p rules.

Usage

You can use service container or facade.

// Using service container
app('Twoc2p')->createPayment($data);

// Using facade
\Twoc2p::createPayment($data);

Create Payment

To create payment and get the payment URL to be redirected to.

Parameter Type Description
invoiceNo string Unique invoice Number
description string Description of the payment
amount decimal The amount of payment
frontendReturnUrl string Redirect to this URL once payment complete

Example as below:

app('Twoc2p')->createPayment([
    'invoiceNo' => '1523953661',   
    'description' => 'item 1',
    'amount' => 100.00,
    'frontendReturnUrl' => 'http://domain.test/your-return-url',
]);

Return example:

array:2 [
  "id" => "94a19a34-965a-4e11-acd2-7acb02696f18"
  "payment_url" => "https://sandbox-pgw-ui.2c2p.com/payment/4.1/#/token/kSAops9Zwhos8hSTSeLTUxxx"
]

Redirect to the payment_url to proceed to 2C2P payment page. Once done, you will be redirected to the frontendReturnUrl. Below is the sample response returned.

{
	"invoiceNo": "280520075921",
	"channelCode": "CC",
	"respCode": "2000",
	"respDesc": "Transaction is completed, please do payment inquiry request for full payment information."
}

Payment Inquiry

To inquire on payment details.

Parameter Type Description
payment_id string Payment ID from create payment.

Example as below:

app('Twoc2p')->paymentInquiry('94a11139-df90-438a-8705-8d88aaa9719e');

Event

This package also provide some events to allow your application to listen to it. You can create your listener and register it under event below.

Event Description
Laraditz\Twoc2p\Events\BackendReceived Received backend response from 2C2P for a payment. Can use to update your payment status and other details

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

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

Credits

License

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

References

laraditz/2c2p 适用场景与选型建议

laraditz/2c2p 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 209 次下载、GitHub Stars 达 4, 最近一次更新时间为 2021 年 10 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「2c2p」 「laraditz」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 laraditz/2c2p 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 laraditz/2c2p 我们能提供哪些服务?
定制开发 / 二次开发

基于 laraditz/2c2p 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-10-14