定制 jpaypp/jpay-skrillpay-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

jpaypp/jpay-skrillpay-php

最新稳定版本:v1.2.1

Composer 安装命令:

composer require jpaypp/jpay-skrillpay-php

包简介

SkrillPay's PHP SDK for REST APIs

README 文档

README

You can sign up for a SkrillPay account at https://www.skrill.com.

Requirements

PHP 5.6.0 and later.

Composer

You can install the bindings via Composer. Run the following command:

composer require jpaypp/jpay-skrillpay-php

To use the bindings, use Composer's autoload:

require_once('vendor/autoload.php');

Manual Installation

If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file.

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

Dependencies

The bindings require the following extensions in order to work properly:

  • curl, although you can use your own non-cURL client if you prefer
  • json
  • mbstring (Multibyte String)

If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.

Getting Started

Simple usage looks like:

init config

$skrill = new ApiContext(
    new OAuthTokenCredential(
        'demoqco@sun-fish.com',
        'skrill',
        'skrill123'
    )
);

$skrill->setConfig(
    array(
        'mode' => 'live',
        'log.LogEnabled' => true,
        'log.FileName' => APPS_PATH .'/../logs/SkrillPay.log',
        'log.LogLevel' => 'INFO', // PLEASE USE `INFO` LEVEL FOR LOGGING IN LIVE ENVIRONMENTS
        'cache.enabled' => false,
        'http.CURLOPT_CONNECTTIMEOUT' => 30
    )
);

checkout

$payer = new Payer();
$payer->setPaymentMethod('quick');


$payerInfo = new PayerInfo();

$payerInfo->setPayToEmail($skrill->getCredential()->getClientId())
    ->setLogoUrl('company logo url')
    ->setRecipientDescription('http://xxxx/company desc')
    ->setTransactionId(time())

    ->setReturnUrl('http://xxxx/callback.html')
    ->setReturnUrlTarget('_self')
    ->setReturnUrlText('返回信息描述')

    ->setCancelUrl('cancle.html')
    ->setCancelUrlTarget('_self')

    ->setStatusUrl('http://xxxx/notify.html');


$amount = new Amount();

$amount->setCurrency("EUR")
       ->setAmount('1')
       ->setDetail1Text('test')
       ->setDetail1Description('年费会员');

$checkout = new Checkout();

$checkout->setPayer($payer) //base
    ->setPayerInfo($payerInfo)  //merchant
    ->setCustomer( new Customer()) //customer
    ->setAmount($amount) //amount
    ->setPrepareOnly('1');  //generate a SID

try {
    $checkout->create($skrill);
} catch (\Exception $e) {
    echo json_encode(array('code'=>201,'data'=>$e->getMessage()))."\r\n";
    die();
}

$approvalUrl = $checkout->getApprovalLink();

Notify callback

$skrill = new ApiContext(
    new OAuthTokenCredential(
        'demoqco@sun-fish.com',
        'skrill',
        'skrill123'
    )
);

$skrill->setConfig(
    array(
        'mode' => 'live',
        'log.LogEnabled' => true,
        'log.FileName' => APPS_PATH .'/../logs/SkrillPay.log',
        'log.LogLevel' => 'INFO', // PLEASE USE `INFO` LEVEL FOR LOGGING IN LIVE ENVIRONMENTS
        'cache.enabled' => false,
        'http.CURLOPT_CONNECTTIMEOUT' => 30
    )
);

$payload = json_encode($_POST);

$hook = new Webhook();
$hook->setPayload($payload);

try{
    if($hook->verify($skrill)){
        $payload = $hook->getVerifyWebhookSignature()->getWebhookResponse();
        //业务处理

    }
}catch (Exception $e){

}

Development

Get [Composer][composer]. For example, on Mac OS:

brew install composer

Install dependencies:

composer install

统计信息

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

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2019-06-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固