定制 shabananavas/php-bluesnap-sdk 二次开发

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

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

shabananavas/php-bluesnap-sdk

最新稳定版本:v0.3.5

Composer 安装命令:

composer require shabananavas/php-bluesnap-sdk

包简介

A PHP SDK for the BlueSnap API

README 文档

README

This (unofficial) library standardizes and simplifies working with the BlueSnap API.

All the standard API documentation is applicable to this library.

View the BlueSnap documentation here: https://developers.bluesnap.com/

This library currently supports:

  • CardTransactions
  • VaultedShoppers
  • Vendors
  • Subscriptions
  • Plans (Subscriptions)
  • Refunds
  • Reports
  • Generating a Hosted Payment Fields token

Installation

Install this package with composer

composer require shabananavas/php-bluesnap-sdk

Usage

Initialize the library in your class constructor

public function __construct()
{
    $environment = 'sandbox'; // or 'production'
    \Bluesnap\Bluesnap::init($environment, 'YOUR_API_KEY', 'YOUR_API_PASSWORD');
}

Create a New Hosted Payment Fields Token

public function getHostedPaymentFieldsToken() {
  $data = \Bluesnap\HostedPaymentFieldsToken::create();
  return $data['hosted_payment_fields_token'];
}

Create a New Transaction

public function createTransaction()
{
    $response = \Bluesnap\CardTransaction::create([
        'creditCard' => [
            'cardNumber' => '4263982640269299',
            'expirationMonth' => '02',
            'expirationYear' => '2018',
            'securityCode' => '837'
        ],
        'amount' => 10.00,
        'currency' => 'USD',
        'recurringTransaction' => 'ECOMMERCE',
        'cardTransactionType' => 'AUTH_CAPTURE',
    ]);

    if ($response->failed())
    {
        $error = $response->data;
        
        // handle error
    }

    $transaction = $response->data;
    
    return $transaction;
}

See examples for further details on using the library

License

This package is licensed under the MIT License

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-04-18