bagisto-payment-method-development

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Payment Method Development

支付方法开发

Overview

概述

Creating custom payment methods in Bagisto allows you to integrate any payment gateway or processor with your store. Whether you need local payment methods, cryptocurrency payments, or specialized payment flows, custom payment methods provide the flexibility your business requires.
For our tutorial, we'll create a Custom Stripe Payment method that demonstrates all the essential concepts you need to build any type of payment solution.
在Bagisto中创建自定义支付方法,可让您将任意支付网关或处理器与店铺集成。无论您需要本地支付方式、加密货币支付还是特殊支付流程,自定义支付方法都能为您的业务提供所需的灵活性。
在本教程中,我们将创建一个自定义Stripe支付方法,展示构建任何类型支付解决方案所需的所有核心概念。

When to Apply

适用场景

Activate this skill when:
  • Creating new payment methods
  • Integrating payment gateways (Stripe, PayPal, Razorpay, etc.)
  • Adding payment options to checkout
  • Modifying existing payment configurations
  • Creating admin configuration for payment methods
在以下场景中启用此技能:
  • 创建新的支付方法
  • 集成支付网关(Stripe、PayPal、Razorpay等)
  • 在结账流程中添加支付选项
  • 修改现有支付配置
  • 为支付方法创建后台管理配置

Bagisto Payment Architecture

Bagisto支付架构

Bagisto's payment system is built around a flexible method-based architecture that separates configuration from business logic.
Bagisto的支付系统基于灵活的方法型架构构建,将配置与业务逻辑分离。

Core Components

核心组件

ComponentPurposeLocation
Payment Methods ConfigurationDefines payment method properties
Config/payment-methods.php
Payment ClassesContains payment processing logic
Payment/ClassName.php
System ConfigurationAdmin interface forms
Config/system.php
Service ProviderRegisters payment method
Providers/ServiceProvider.php
组件用途位置
支付方法配置定义支付方法属性
Config/payment-methods.php
支付类包含支付处理逻辑
Payment/ClassName.php
系统配置后台管理界面表单
Config/system.php
服务提供者注册支付方法
Providers/ServiceProvider.php

Key Features

核心特性

  • Flexible Payment Processing: Support for redirects, APIs, webhooks, or custom flows.
  • Configuration Management: Admin-friendly settings interface.
  • Multi-channel Support: Different settings per sales channel.
  • Security Ready: Built-in CSRF protection and secure handling.
  • Extensible Architecture: Easy integration with third-party gateways.
  • 灵活的支付处理:支持重定向、API、Webhook或自定义流程。
  • 配置管理:便于后台操作的设置界面。
  • 多渠道支持:每个销售渠道可设置不同配置。
  • 安全就绪:内置CSRF保护与安全处理机制。
  • 可扩展架构:轻松集成第三方网关。

Reference files — load only what the current task needs

参考文件——仅加载当前任务所需内容

FileLoad when
implementation.mdBuilding a payment method — the step-by-step guide
payment-api.mdThe base payment class and the methods to override
reference.mdBuilt-in methods, best practices, a complex integration example, package layout, testing, pitfalls
REQUIRED SUB-SKILL: Use bagisto-change-verification before calling any change done.
文件加载场景
implementation.md构建支付方法——分步指南
payment-api.md基础支付类及需重写的方法
reference.md内置方法、最佳实践、复杂集成示例、包结构、测试、常见陷阱
必备子技能:在完成任何更改前,使用bagisto-change-verification进行验证。