定制 terminal42/swissbilling-api 二次开发

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

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

terminal42/swissbilling-api

Composer 安装命令:

composer require terminal42/swissbilling-api

包简介

Client for the SwissBilling API

README 文档

README

An API client for SwissBilling written in PHP.

ATTENTION: This repo is still in early development and subject to changes!

Installing

composer require terminal42/swissbilling-api

Usage

Basics

Use the Client object to interact with the API. All API types have DocBlock properties, so a smart IDE (like PhpStorm) will give you autocomplete support on the properties.

use Terminal42\SwissbillingApi\Client;
use Terminal42\SwissbillingApi\Api\ApiFactory;
use Terminal42\SwissbillingApi\Type\Debtor;
use Terminal42\SwissbillingApi\Type\Merchant;
use Terminal42\SwissbillingApi\Type\InvoiceItem;
use Terminal42\SwissbillingApi\Type\Transaction;
use Terminal42\SwissbillingApi\Type\TransactionStatus;

$client = new Client(new ApiFactory());

$merchant = new Merchant('user', 'password', 'success_url', 'cancel_url', 'error_url');

$transaction = new Transaction();
// fill in the required transaction properties
// $transaction->amount = 100;

$debtor = new Debtor();
// fill in the required debtor properties
// $transaction->firstname = 'John';
// $transaction->lastname = 'Doe';

$items = [
    new InvoiceItem(),
];

/** @var TransactionStatus $status */
$status = $client->request($transaction, $debtor, $items, $merchant);

var_dump($status->hasError());

Multiple calls / Dependency Injection

You can pass the merchant information to the Client instead of passing it on every method call, e.g. if using this in a Symfony bundle with dependency injection.

$merchant = new Merchant('user', 'password', 'success_url', 'cancel_url', 'error_url');
$client = new Client(new ApiFactory(), $merchant);

// No need to pass the merchant anymore
$status = $client->request($transaction, $debtor, $items);

Software Best Practice

This repository is following SemVer. If you rely on a stable API, make sure to install a version tag.

License

Licensed under the MIT license.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-02-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固