PHP code example of optiosteam / tikkie-client-php

1. Go to this page and download the library: Download optiosteam/tikkie-client-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

optiosteam / tikkie-client-php example snippets


use Optios\Tikkie\TikkieApiClient;

$client   = new TikkieApiClient('your_api_key', null, null, false);
$appToken = $client->getSandboxAppToken();
var_dump($appToken);

use Optios\Tikkie\Request\CreatePaymentRequest;
use Optios\Tikkie\TikkieApiClient;

$client = new TikkieApiClient('your_api_key', 'your_app_token', null, false);

$paymentRequest = new CreatePaymentRequest('This is a description');
$paymentRequest->setAmountInCents(500);
$result = $client->createPaymentRequest($paymentRequest);
var_dump($result);

use Optios\Tikkie\TikkieApiClient;

$client = new TikkieApiClient('your_api_key', 'your_app_token', null, false);
$result = $client->getPaymentRequest('payment_request_token');
var_dump($result);

use Carbon\Carbon;
use Optios\Tikkie\Request\GetAllPaymentRequests;
use Optios\Tikkie\TikkieApiClient;

$client  = new TikkieApiClient('your_api_key', 'your_app_token', null, false);
$request = new GetAllPaymentRequests(
    0,
    50
);
$request->setFromDateTime(Carbon::now()->subHours(2));

$result = $client->getAllPaymentRequests($request);
var_dump($result);

use Optios\Tikkie\Request\GetPaymentPathVariables;
use Optios\Tikkie\TikkieApiClient;

$client = new TikkieApiClient('your_api_key', 'your_app_token', null, false);
$result = $client->getPaymentFromPaymentRequest(
    new GetPaymentPathVariables('payment_request_token', 'payment_token')
);
var_dump($result);

use Optios\Tikkie\Request\GetAllPaymentsForPaymentRequest;
use Optios\Tikkie\TikkieApiClient;

$client = new TikkieApiClient('your_api_key', 'your_app_token', null, false);
$result = $client->getAllPaymentsForPaymentRequest(
    new GetAllPaymentsForPaymentRequest(
        'payment_request_token',
        0,
        10,
        true
    )
);
var_dump($result);

use Optios\Tikkie\Request\CreateRefund;
use Optios\Tikkie\Request\GetPaymentPathVariables;
use Optios\Tikkie\TikkieApiClient;

$client = new TikkieApiClient('your_api_key', 'your_app_token', null, false);
$result = $client->createRefund(
    new CreateRefund(
        new GetPaymentPathVariables('payment_request_token', 'payment_token'),
        'Refund of € 1.5',
        150
    )
);
var_dump($result);

use Optios\Tikkie\Request\GetRefundPathVariables;
use Optios\Tikkie\TikkieApiClient;

$client = new TikkieApiClient('your_api_key', 'your_app_token', null, false);
$result = $client->getRefund(
    new GetRefundPathVariables(
        'payment_request_token',
        'payment_token',
        'refund_token'
    )
);
var_dump($result);

composer