Skip to content

xinlai3698/pingpp-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pingpp PHP SDK

简介

lib 文件夹下是 PHP SDK 文件,
example 文件夹里面是简单的接入示例,该示例仅供参考。

版本要求

PHP 版本 5.3 及以上

安装

使用 Composer

composer.json 中添加以下代码

{
  "require": {
    "pingplusplus/pingpp-php": "dev-master"
  }
}

然后执行

composer install

使用 Composer 的 autoload 引入

require_once('vendor/autoload.php');

手动引入

require_once('/path/to/pingpp-php/init.php');

接入方法

初始化

\Pingpp\Pingpp::setApiKey('YOUR-KEY');

支付

$ch = \Pingpp\Charge::create(
    array(
        'order_no'  => '123456789',
        'app'       => array('id' => 'YOUR-APP-ID'),
        'channel'   => 'alipay',
        'amount'    => 100,
        'client_ip' => '127.0.0.1',
        'currency'  => 'cny',
        'subject'   => 'Your Subject',
        'body'      => 'Your Body',
        'extra'     => $extra
    )
);

查询

\Pingpp\Charge::retrieve('CHARGE_ID');
\Pingpp\Charge::all(array('limit' => 5));

退款

$ch = \Pingpp\Charge::retrieve('CHARGE_ID');
$re = $ch->refunds->create(array('description' => 'Refund Description');

退款查询

$ch = \Pingpp\Charge::retrieve('CHARGE_ID');
$ch->refunds->retrieve('REFUND_ID');
$ch = \Pingpp\Charge::retrieve('CHARGE_ID');
$ch->refunds->all(array('limit' => 5));

微信红包

\Pingpp\RedEnvelope::create(
    array(
        'order_no'  => '123456789',
        'app'       => array('id' => 'YOUR-APP-ID'),
        'channel'   => 'wx_pub',
        'amount'    => 100,
        'currency'  => 'cny',
        'subject'   => 'Your Subject',
        'body'      => 'Your Body',
        'extra'     => array(
            'nick_name' => 'Nick Name',
            'send_name' => 'Send Name'
        ),
        'recipient'   => 'Openid',
        'description' => 'Your Description'
    )
);

查询

\Pingpp\RedEnvelope::retrieve('RED_ID');
\Pingpp\RedEnvelope::all(array('limit' => 5));

详细信息请参考 API 文档

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%