• Stars
    star
    234
  • Rank 171,143 (Top 4 %)
  • Language
    PHP
  • Created about 4 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

简洁、高效的多用户、多语言、用插件扩展的聚合支付系统,已集成 Alipay China, Alipay Global 和 Paypal

Introduction

Simple and efficient multi-user, multi-language converged payment system. Provides cash payment and Auto Debit via one URL, supports Alipay China, Alipay Global and Paypal, etc., it can be extended through plug-ins. Admin Panel can view logs, transaction flow, configuration.

简洁、高效的多用户、多语言的聚合支付系统。 通过一个 URL 提供现金付款和订阅支付(Auto Debit),支持支付宝中国,支付宝国际版和 Paypal 等,可通过插件扩展。Admin panel 可查看日志、交易流水,配置。

Suitable for cashier, multi-channel collection, multi-channel settlement, four-party payment, payment load balancing and other scenarios.

适合收银台、多渠道收款、多渠道结算、四方支付、支付负载均衡等场景。

What is Converged Payment System

What is Converged payment system

License Agreement

The system shall not be used for any purposes prohibited by laws of mainland China, Hong Kong or the United States.
The system shall not be used for commercial purposes without permission.

本系统不得用于中国大陆、香港、美国法律所禁止的用途。
未经许可,不得用于商业用途。

Demo

Checkout Page

Checkout Page

ScreenShoot

  • PC Checkout Page PC Screenshoot
  • Mobile Checkout Page Mobile Screenshoot

Admin Panel

Admin
Account: admin
Password: yzhan

ScreenShoot

Admin Panel

Install

Step 1 Import SQL

source install.sql

Step 2 Update Your Channel Config

  • Get your app_id client_id secret key from Alipay China / Alipay Global / Paypal
  • Find yzhan_channel, update config field

Step 3 Install Dependency

# Front-End: Enter Project Root Directory / 
npm install
# Back-End: Eneter /src/api/
composer require

Step 4 Add scheduled task

Add the URL below to the scheduled task

{Your Website Url}/api/run/{Maximum number of tasks per run}

Examples of setting scheduled tasks:

  • Use BT panel
    Run task on BT panel
  • Use Linux crontab
crontab -e # Edit Crontab
*/1 * * * * wget {Your Website Url}/api/run/{Maximum number of tasks per run} # wget / curl URL every 1 minute

Document

How to Use

Cash payment and Subscription payment are combined into one API:
API Document

How to add a new Plugin

Step 1 Create a Plugin in Admin Panel

Create a Plugin in Admin Panel

Step 2 Create a Json to describe the Plug-in

// JSON doesn't support comments. 
// Please delete comments when copying
{
	"name": "paypal", // Plugin Name
	"version": "1.0.0", // Plugin Version
	"displayname": "Paypal", // Plugin Display Name
	"type": "pay", // Plugin Type, Optional: pay / theme / language
	"payment": "depositcard,paypal", // Payment provided by the plug-in to the user
	"ability": "checkout,subscription", // Payment ability provided by plugin
	"author": "mantoufan", // Plugin author
	"link": "https://github.com/mantoufan", // Plugin Website URL
	"input": [ // Configurable items provided by plugin, it can be configured in Admin Panel
		{ "type":"text", "label":"Client ID", "name":"client_id" },
		{ "type":"text", "label":"Secret", "name":"secret" },
		{ "type":"checkout", "label":"Sandbox", "name":"is_sandbox" }
	],
	"composer": {
		"require": { // Dependent third-party components
			"paypal/paypal-checkout-sdk": "^1.0",
			"andreimosman/paypal-subscriptions-sdk": "^1.0"
		}
	}
}

Step 3 Create a Plugin folder

  • Save JSON as config.json
  • Put it into new folder
  • Rename folder name with plugin name

Step 4 Implement abstract class

  • Create a php named plugin name
  • Implement abstract class in it
abstract class MyPaymentPlugin {
  public function getGateway($channel_id) // Get the configuration and initialize the gateway
  {
      $config = PluginService::GetChannelConfig($channel_id);
      if (empty($config)) {
          $this->export(array('status' => 403));
      }
      if ($config['env'] === 'sandbox') {
          $environment = new SandboxEnvironment($config['client_id'], $config['secret']);
      } else {
          $environment = new ProductionEnvironment($config['client_id'], $config['secret']);
      }
      return new PayPalHttpClient($environment);
  }
  abstract public function checkout($channel_id, $params); // Single Payment -> Pay Channel Cashier
  abstract public function sync($channel_id); // Process sync notifications received by checkout / subscribe
  abstract public function async($channel_id); // Process async notifications received by checkout / subscribe
  abstract public function cancel($channel_id); // Process user cancel, paypal only
  abstract public function subscribe($channel_id, $params); // Subscribe Payment -> Pay Channel Agreement or Auth Page
  abstract public function syncSubscribe($channel_id); // Process sync notifications received by subscribe
  abstract public function asyncSubscribe($channel_id); // Process async notifications received by subscribe
  abstract public function charge($channel_id, $params = array('trade_no' => 0, 'customer_id' => 0, 'subscription_id' => 0, 'note' => '', 'amount' => 0, 'currency' => ''));
  // Subscribe Payment -> Initiate the request to deduct the fee, Alipay Global Only
}

Flow

State Machine

All Trade Status in System

const TRADE_STATUS = array(
    'CREATED' => 'CREATED',
    'CHECKOUT_SUCCEED' => 'CHECKOUT_SUCCEED',
    'CHECKOUT_FAIL' => 'CHECKOUT_FAIL',
    'SUBSCRIPTION_WAIT_REMIND' => 'SUBSCRIPTION_WAIT_REMIND',
    'SUBSCRIPTION_WAIT_CHARGE' => 'SUBSCRIPTION_WAIT_CHARGE',
    'SUBSCRIPTION_CHARGE_SUCCEED' => 'SUBSCRIPTION_CHARGE_SUCCEED',
    'SUBSCRIPTION_CHARGE_FAIL' => 'SUBSCRIPTION_CHARGE_FAIL',
    'CLOSED' => 'CLOSED',
);

State Flow of Single Payment / Cash payment

State of Single Payment / Cash payment

State Flow of Subscription Payment

State of Subscription Payment

Architecture Diagram

Architecture Diagram

Sequence Diagram

Loop Queue

Auto Debit and Reminder

Auto Debit and Reminder Loop Queue

Notity

Notity Loop Queue

Subscription Flow

View big Picture about Subscription Flow Subscription Flow

More Repositories

1

alipay-global-sdk-php

Alipay global Third Party SDK with Authorization and Auto debit. Alipay 国际版 A+ 接口第三方 PHP SDK,实现了现金支付、用户授权、自动代扣和 RSA2 加密异步通知应答,示例完整,使用简单
PHP
412
star
2

yzhanProxy

Web reverse proxy with automatic SSL, LFU caching, command-line configuration 支持自动配置 SSL 证书、LFU 缓存、用命令行配置的 Web 反向代理服务器
Go
295
star
3

yzhanDanmu

CSS-only bullet screen plugin. Any height, length, speed. Multiple non-overlapping strategies. High efficiency, minimal size (2kb). Channel algorithm patented. 纯 CSS 弹幕插件,任意高度、长度、速度弹幕铺满屏幕,多种不重叠策略,高效极简(2kb)。通道算法受专利权保护。
JavaScript
280
star
4

yzhanJSInterpreter

A JavaScript Interpreter Using JS itself. JavaScript 解释器,包含词法分析、语法解析和执行。基于 LR 实现 eval
JavaScript
213
star
5

yzhanWeather

Pure CSS animation for sakura, rain, snow, firefly and butterfly effects, high performance without affecting SEO. 纯 CSS 动画实现樱花、雨、雪、萤火虫和蝴蝶飞舞背景效果,高性能且不影响 SEO
JavaScript
154
star
6

yzhanHTMLParser

A streaming HTML parser based on HTML Standard. 基于 HTML 标准的流式 HTML 解析器
HTML
108
star
7

mtfLive

MTF直播导航源码,将斗鱼、虎牙、触手、YY、龙珠、战旗、章鱼、电视直播按分类/关键词聚合,用户选择分类,可以观看到全网该关键词下正在直播的内容。
PHP
68
star
8

yzhanIP

Crawl, match, parse IP or IP range, check if IP or range is in another range. Support IPv4, IPv6, IP Interval, Wildcard and CIDR. Check if IP is Cloudflare node IP, Google bot IP. 爬取,正则匹配,解析 IP 和 IP 范围,检测 IP 或范围是否在另一个范围中。支持 IPv4,IPv6,区间、通配符或 CIDR 表示的 IP 范围。检测 IP 是否是 Cloudflare 节点或 Google 漫游器 IP
PHP
58
star
9

yZhanCrop

仿 PS 多图层的图片选择、缩放、旋转、裁剪、导出 JS 库 Crop images by dragging, zooming, tilting and rotating them.
JavaScript
56
star
10

yzhanBG

Use multiple videos, images, and weather as background, with mute, hide, text, and cherry blossom, rain, snow, firefly, and butterfly animations. 用多个视频、图片、天气作背景,支持静音、隐藏内容、文字,以及樱花、雨、雪、萤火虫和蝴蝶动画
JavaScript
55
star
11

yzhanNotify

Element and Global Notifications / Toasts with Pure / Vanilla / Native JavaScript. 使用原生 JavaScript 在视窗或元素的指定位置发送通知和提示。
CSS
41
star
12

yzhanCache

Simple, efficient cache for php. 简单、高效的 PHP 缓存类
PHP
38
star
13

yzhanGateway

Developing PHP SDK for any API. 为任何 API 快速开发 PHP SDK
PHP
38
star
14

mtfScrollList

MTF滚动列表插件,支持虚拟化无限滚动,上拉到顶,下拉到底加载更多,下拉刷新。可在原生JS、React和Vue(未来)中使用
JavaScript
36
star
15

yzhanImageViewer

给网站和H5应用增加 像微信朋友圈一样 的看图功能,可看大图,双击双指缩放,滑动切换图片,点击返回。A jQuery Plugin for viewing pictures like Wechat moments.
JavaScript
27
star
16

mtfCOM

mtf 通用组件库,包含多个 PHP 模块和 JavaScript 模块,其中以 mtf 或 yzhan 开头模块,为自有模块,其它为第三方模块。这些模块可独立或组合使用,无需为某一个功能而引入整个框架。
PHP
10
star
17

yzhanCluster

Sources of depolyment yamls and static files for yzhan
JavaScript
8
star
18

mtfSTGMaker

MTF射击游戏生成器,封装角色、装备、碰撞检测、资源预加载、键盘和触屏操控等底层实现,帮助您快速开发射击游戏
JavaScript
7
star
19

mzhanSub

M站字幕组翻译的字幕,包括每周五更新的《3D坦克周报》。不定期更新的《TankiX开发日志》和《可爱女生发型系列视频教程》
6
star
20

yzhanCodeSpace

This is a space for me to investigate Souce Code of Vue.js / React / Webpack / Rollup etc.
JavaScript
2
star
21

yzhanReactResponsiveContent

A powerful and flexible React component for creating responsive content with automatic media query generation. 为响应式内容自动生成媒体查询
TypeScript
2
star
22

yzhanAPI

MTF接口:二维码识别、图片倾斜校正、短链接生成、清晰度增强、答题卡识别和正版验证
PHP
2
star
23

yzhanModal

A jQuery plugin to show a modal dialog with support for iframes
JavaScript
1
star
24

shopxoplugin

shopXO plugin by xiaoyu
HTML
1
star
25

yzhanGoRun

Write once, run everywhere
Go
1
star
26

yZhanWeather

Y站天气库,动态生成雪、雨、光、樱花、蝴蝶和气泡效果,可作为H5活动页的装饰动画和背景。
1
star