PHP code example of paysera / lib-checkout-client

1. Go to this page and download the library: Download paysera/lib-checkout-client 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/ */

    

paysera / lib-checkout-client example snippets


use Paysera\Client\CheckoutClient\ClientFactory;

$clientFactory = new ClientFactory([
    'base_url' => 'https://checkout-eu-a.paysera.com/checkout/rest/v1/', // optional, in case you need a custom one.
    'basic' => [                                        // use this, it API en' => 'my-refresh-token',
        ],
    ],
    // other configuration options, if needed
]);

$checkoutClient = $clientFactory->getCheckoutClient();


$result = $checkoutClient->cancelPaymentRequest($id);


$result = $checkoutClient->getPaymentRequestPublicInfo($id);

use Paysera\Client\CheckoutClient\Entity as Entities;

$email = new Entities\Email();

$email->setEmail($email);
    
$result = $checkoutClient->setPaymentRequestEmail($id, $email);

use Paysera\Client\CheckoutClient\Entity as Entities;

$filter = new \Paysera\Component\RestClientCommon\Entity\Filter();

$filter->setLimit($limit);
$filter->setOffset($offset);
$filter->setOrderBy($orderBy);
$filter->setOrderDirection($orderDirection);
$filter->setAfter($after);
$filter->setBefore($before);
    
$result = $checkoutClient->getPaymentRequestMethods($id, $filter);

use Paysera\Client\CheckoutClient\Entity as Entities;

$paymentMethod = new Entities\PaymentMethod();

$paymentMethod->setMethodKey($methodKey);
    
$result = $checkoutClient->startPaymentRequestPayment($id, $paymentMethod);

use Paysera\Client\CheckoutClient\Entity as Entities;

$authorizationParameters = new Entities\AuthorizationParameters();

$authorizationParameters->setToken($token);
    
$result = $checkoutClient->authorizePaymentRequest($id, $authorizationParameters);


$result = $checkoutClient->capturePaymentRequest($id);


$result = $checkoutClient->getPaymentRequest($id);

use Paysera\Client\CheckoutClient\Entity as Entities;

$paymentRequest = new Entities\PaymentRequest();

$paymentRequest->setId($id);
$paymentRequest->setStatus($status);
$paymentRequest->setBusinessId($businessId);
$paymentRequest->setOrderId($orderId);
$paymentRequest->setUniqueIdentifier($uniqueIdentifier);
$paymentRequest->setPrice($price);
$paymentRequest->setPricePaid($pricePaid);
$paymentRequest->setValidUntil($validUntil);
$paymentRequest->setLocale($locale);
$paymentRequest->setDescription($description);
$paymentRequest->setMethodCountry($methodCountry);
$paymentRequest->setMethodKey($methodKey);
$paymentRequest->setPayer($payer);
$paymentRequest->setInformationRequest($informationRequest);
$paymentRequest->setCardDataRestriction($cardDataRestriction);
$paymentRequest->setAcceptUrl($acceptUrl);
$paymentRequest->setCancelUrl($cancelUrl);
$paymentRequest->setCallbackUrl($callbackUrl);
$paymentRequest->setAuthorizationUrl($authorizationUrl);
$paymentRequest->setAffiliateKey($affiliateKey);
$paymentRequest->setParameters($parameters);
$paymentRequest->setTokenStrategy($tokenStrategy);
$paymentRequest->setIssuedToken($issuedToken);
    
$result = $checkoutClient->createPaymentRequest($paymentRequest);

use Paysera\Client\CheckoutClient\Entity as Entities;

$paymentRequestFilter = new Entities\PaymentRequestFilter();

$paymentRequestFilter->setBusinessId($businessId);
$paymentRequestFilter->setStatus($status);
$paymentRequestFilter->setMethodKey($methodKey);
    
$result = $checkoutClient->getPaymentRequests($paymentRequestFilter);