PHP code example of paysera / lib-checkout-integration-sdk
1. Go to this page and download the library: Download paysera/lib-checkout-integration-sdk 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-integration-sdk example snippets
use Paysera\CheckoutSdk\SdkFacadeBuilder;
use Paysera\CheckoutSdk\Entity\PaymentApiCredentials;
// Build SDK facade with minimal configuration
$sdkFacade = (new SdkFacadeBuilder())
->build()
;
// Authorize with your API credentials
$apiCredentials = new PaymentApiCredentials(
'your-client-id',
'your-client-secret'
);
$sdkFacade
->getAuthorizationFacade()
->authorize($apiCredentials)
;
// Now you're ready to process payments
use Paysera\CheckoutSdk\SdkFacadeBuilder;
$sdkFacade = (new SdkFacadeBuilder())
// Optional: Set custom PSR-3 logger. NullLogger by default
->setLogger($logger)
// Optional: Set custom PSR-18 HTTP client. CurlHttpClient by default
->setHttpClient($httpClient)
// Optional: Set custom PSR-6 cache pool. InMemoryCache by default.
// Caches Keycloak JWKS used for JWT signature verification.
// Persistent pool (Redis/APCu/filesystem) is strongly recommended in
// production — see "JWKS cache" section below.
->setCacheItemPool($cacheItemPool)
// Optional: Set custom PSR-20 clock. System clock by default
// Used for time-based operations like token expiration
->setClock($clock)
// Optional: Set auth token repository. InMemoryRepository by default
// Permanently stores payment API access tokens
// Needed for using the same token between requests
->setPaymentApiAuthTokenRepository($paymentApiAuthTokenRepository)
// Optional: Set credentials repository. InMemoryRepository by default
// Permanently stores payment API credentials
// Needed for automatically refreshing tokens
->setPaymentApiCredentialsRepository($paymentApiCredentialsRepository)
// Optional: Set custom API client formatter. SecureApiClientFormatter by default
// Controls how HTTP requests/responses are formatted in logs
->setApiClientFormatter($apiClientFormatter)
->build()
;
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.