acquired / php-api-library

用于访问Acquired API的PHP客户端库

dev-master 2020-05-28 12:42 UTC

This package is not auto-updated.

Last update: 2024-09-25 04:03:09 UTC


README

描述

Acquired API库为PHP提供了使用Acquired API的功能。

目录

|--example  
    auth_.html
    auth_.php
    refund.html
    refund.php
    ...
|--lib  
    AcquiredCommon.php
    AcquiredConfig.php
    AcquiredException.php
    |--service
        HandlePub.php
        AuthHandle.php
        AuthOnlyHandle.php
        CaptureHandle.php
        AuthCaptureHandle.php
        ...
|--public  
    |--css
        general.css
    |--js
|--logs
readme.md  
index.php

文档

https://developer.acquired.com/integrations

安装

您可以使用Composer或直接下载发行版。

Composer

首选方法是通过Composer。如果您尚未安装Composer,请按照安装说明进行操作。安装Composer后,在项目根目录下执行以下命令来安装此库:

composer require Acquired/php-api-library:dev-master

示例

开始使用

  1. 在AcquiredConfig.php中设置配置参数。
  2. 将示例目录移动到您的Web根目录。
  3. 如果您使用Composer,请在示例文件中引入以下文件。
require_once __DIR__ . '/../vendor/autoload.php';

如何使用

使用方法非常简单,如下所示:

  1. 根据您的交易类型创建一个对象。
use Acquired\Service\AuthHandle;
$auth = new AuthHandle();
  1. 设置参数。
$auth->setParam("amount",1);
  1. 发送参数。
$result = $auth->postJson();
  1. 处理响应。
$response_hash = $auth->generateResHash($result);
if($reponse_hash == $result['response_hash']){
    
    // do your job.
    
}

要求

PHP 5.3+
Curl