affinipay/chargeio-php 问题修复 & 功能扩展

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

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

affinipay/chargeio-php

Composer 安装命令:

composer require affinipay/chargeio-php

包简介

AffiniPay PHP Library

README 文档

README

PHP Client Library for the AffiniPay Payment Gateway

Installation

Download the PHP client library:

git clone git://github.com/charge-io/chargeio-php.git 

To use the library in your application, add the following to your PHP script:

require_once '/path/to/chargeio-php/lib/ChargeIO.php'; 

Set up ChargeIO credentials

The library's APIs require credentials to access your merchant data on the AffiniPay servers. You can either:

  • Provide credentials as arguments to each API call.

  • Configure the library with default credentials.

    To set default credentials, call ChargeIO::setCredentials with an AffiniPay_Credentials object. The AffiniPay_Credentials object is instantiated with a public_key and a secret_key.

    ChargeIO::setCredentials(new AffiniPay_Credentials('<public_key>', '<secret_key>'));

Using AffiniPay hosted fields to create a charge token

You must tokenize all sensitive payment information before you submit it to AffiniPay. On your payment form, use AffiniPay’s hosted fields to secure payment data and call window.AffiniPay.HostedFields.getPaymentToken to create a one-time payment token. See "Creating payment forms using hosted fields". Then, POST the payment token ID to your PHP script.

Making a charge

Pass an amount and the one-time token ID returned from your payment page to complete a charge.

 $amount = $_POST['amount']; $token_id = $_POST['token_id']; $charge = ChargeIO_Charge::create(new ChargeIO_PaymentMethodReference(array('id' => $token_id)), $amount); 

Documentation

The latest AffiniPay Payment Gateway API documentation is available at https://developers.affinipay.com/reference/api.html#PaymentGatewayAPI.

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 6
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固