PHP code example of tuutti / php-paytrail-payment-api

1. Go to this page and download the library: Download tuutti/php-paytrail-payment-api 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/ */

    

tuutti / php-paytrail-payment-api example snippets





apiInstance = new Paytrail\Payment\Api\PaymentReportsApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$payment_report_request = new \Paytrail\Payment\Model\PaymentReportRequest(); // \Paytrail\Payment\Model\PaymentReportRequest | Payment body payload
$checkout_account = 375917; // int | Merchant ID
$checkout_algorithm = sha512; // string | HMAC algorithm
$checkout_method = POST; // string | HTTP method of the request
$checkout_timestamp = 2018-08-08T10:10:59Z; // \DateTime | Current timestamp in ISO 8601 format
$signature = 'signature_example'; // string | HMAC signature calculated over the request headers and payload

try {
    $result = $apiInstance->requestPaymentReport($payment_report_request, $checkout_account, $checkout_algorithm, $checkout_method, $checkout_timestamp, $signature);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling PaymentReportsApi->requestPaymentReport: ', $e->getMessage(), PHP_EOL;
}

json
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/tuutti/php-paytrail-payments-api.git"
    }
  ],
  "