2017 © Pedro Peláez
 

library yii2-alipay

a Alipay Composer Package

image

davidxu/yii2-alipay

a Alipay Composer Package

  • Saturday, August 19, 2017
  • by davidxuuts
  • Repository
  • 1 Watchers
  • 3 Stars
  • 30 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

The Alipay Composer Package

a Alipay Composer Package, (*1)

Description

This is for alipay app pay purpose., (*2)

Based on Alipay-SDK-PHP-4.9.0, (*3)

Installation

The preferred way to install this extension is through composer., (*4)

Either run, (*5)

php composer.phar require davidxu/yii2-alipay "*"

or add, (*6)

"davidxu/yii2-alipay": "*"

to the require section of your composer.json file., (*7)

Usage Example for App Pay Order Generation Request

use davidxu\alipay\Alipay;
use davidxu\alipay\request\AlipayTradeAppPayRequest;

$notifyUrl = 'https://<your_domain>/alipay/notify';

$alipay = new Alipay();

$alipay->gatewayUrl = "https://openapi.alipay.com/gateway.do";
$alipay->appId = "<app_id>";
$alipay->rsaPrivateKey = '<private_key_in_one_line>' ;
$alipay->format = "json";
$alipay->charset = "UTF-8";
$alipay->signType = "RSA2";
$alipay->alipayrsaPublicKey = '<alipay_public_key_NOT_DEVELOPER_PUBLIC_KEY>';

$request = new AlipayTradeAppPayRequest();

$bizcontent = json_encode([
                  'body' => 'Body of test data',
                  'subject' => 'App Pay Test',
                  'out_trade_no' => '2020012511013510000',
                  'timeout_express' => '30m',
                  'total_amount' => '0.01',
                  'product_code' => 'QUICK_MSECURITY_PAY',
              ]);

$request->setNotifyUrl($notifyUrl);
$request->setBizContent($bizcontent);

$orderString = $alipay->sdkExecute($request);

// Client side can use this string for orderString directly.
echo $orderString;

Usage Example for App Pay Async Notification


Http Method: POST Request URL: https://<your_domain>/alipay/notify <notifyUrl>
use davidxu\alipay\Alipay;

$alipay = new Alipay();
$alipay->alipayrsaPublicKey = <alipay_public_key_NOT_DEVELOPER_PUBLIC_KEY>;

$flag = $alipay->rsaCheckV1($request, null, 'RSA2');

// Other code such as deal with business logic and etc

// Response ali post request
echo 'success';

Contact

If anything please contact at david.xu.uts@163.com, (*8)

Have fun., (*9)

The Versions

19/08 2017

dev-master

9999999-dev

a Alipay Composer Package

  Sources   Download

MIT

The Requires

  • php >5.5

 

by David Xu

extension yii2 alipay

19/08 2017

1.0.4

1.0.4.0

a Alipay Composer Package

  Sources   Download

MIT

The Requires

  • php >5.5

 

by David Xu

extension yii2 alipay

19/08 2017

1.0.3

1.0.3.0

a Alipay Composer Package

  Sources   Download

MIT

The Requires

  • php >5.5

 

by David Xu

extension yii2 alipay

03/07 2017

1.0.2

1.0.2.0

a Alipay Composer Package

  Sources   Download

MIT

The Requires

  • php >5.5

 

by David Xu

extension yii2 alipay

15/04 2017

1.0

1.0.0.0

a Alipay Composer Package

  Sources   Download

MIT

The Requires

  • php >5.5

 

by David Xu

extension yii2 alipay

15/04 2017

1.0.1

1.0.1.0

a Alipay Composer Package

  Sources   Download

MIT

The Requires

  • php >5.5

 

by David Xu

extension yii2 alipay

14/04 2017

0.1

0.1.0.0

a Alipay Composer Package

  Sources   Download

MIT

The Requires

  • php >5.5

 

by David Xu

extension yii2 alipay