定制 jarnovanleeuwen/php-tikkie 二次开发

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

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

jarnovanleeuwen/php-tikkie

最新稳定版本:v0.2.4

Composer 安装命令:

composer require jarnovanleeuwen/php-tikkie

包简介

Implementation of the Tikkie API interface.

README 文档

README

Build Status

⚠️ Tikkie has announced that on 01-01-2021 it will stop supporting the Tikkie Payment Request API (the API that this library implements) in favor of the new Tikkie API. See https://medium.com/abn-amro-developer/abn-amro-introduces-the-new-tikkie-api-87c8bb54720a for more information, including a roadmap.

Currently, I am not planning to update this library. This might change in the future, but meanwhile PRs are welcome.

Easily create payment requests through Tikkie.

Unofficial PHP implementation of the Tikkie Payment Request API (deprecated, available until 01-01-2021).

Installation

PHPTikkie requires PHP 7.1+

Add this package to your project using Composer:

composer require jarnovanleeuwen/php-tikkie

Usage

Initialise PHPTikkie

use PHPTikkie\Environment;
use PHPTikkie\PHPTikkie;

$apiKey = "abc123";
$testMode = true;

$environment = new Environment($apiKey, $testMode);
$environment->loadPrivateKey('private_rsa.pem');

$tikkie = new PHPTikkie($environment);

Create platform

use PHPTikkie\Entities\Platform;

$platform = $tikkie->newPlatform([
    // Mandatory attributes
    'name' => 'YourPlatform',
    'phoneNumber' => '06123456789',
    'platformUsage' => Platform::USAGE_TYPE_MYSELF,

    // Optional attributes
    'email' => 'tikkie@yourcompany.com',
    'notificationUrl' => ''
])->save();

$platformToken = $platform->platformToken;

Create user

$user = $tikkie->newUser($platformToken, [
    'name' => 'ExamplePlatform',
    'phoneNumber' => '06123456789',
    'iban' => 'NL00BANK123456789',
    'bankAccountLabel' => 'YourLabel'
])->save();

$userToken = $user->userToken;
$bankAccountToken = $user->bankAccounts[0]->bankAccountToken;

Create payment request

$paymentRequest = $tikkie->newPaymentRequest($platformToken, $userToken, $bankAccountToken, [
    // Mandatory attributes
    'amountInCents' => '1250',
    'currency' => 'EUR',
    'description' => 'Thank you',
    'externalId' => 'Order 1234'
])->save();

$tikkieUrl = $paymentRequest->paymentRequestUrl;
$paymentRequestToken = $paymentRequest->paymentRequestToken;

Get payment request

function paymentRequest(string $platformToken, string $userToken, string $paymentRequestToken): PaymentRequest

List platforms

function platforms(): Platform[]

List users

function users(string $platformToken): User[]

List payment requests

function paymentRequests(string $platformToken, string $userToken, int $offset, int $limit, DateTimeInterface $fromDate = null, DateTimeInterface $toDate = null): PaymentRequest[]

Process payments

$paymentRequest = $tikkie->paymentRequest($platformToken, $userToken, $paymentRequestToken);

foreach ($paymentRequest->payments as $payment) {
    if ($payment->isPaid()) {
        // Payment successful
    }
}

Exception handling

All methods may return a PHPTikkieException containing an error code and description.

use PHPTikkie\Exceptions\PHPTikkieException;

try {
    var_dump($tikkie->platforms());
} catch (PHPTikkieException $exception) {
    print $exception->getMessage(); // [ERR_2005_002] The API Key is invalid for the requested resource | traceId: 6fda2ce8-225d-4ca2-920a-b687c7aeb2f3 | (see https://developer.abnamro.com/get-started#obtaining-an-api-key)
}

统计信息

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

GitHub 信息

  • Stars: 23
  • Watchers: 4
  • Forks: 8
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-12-12