PHP code example of owlookit / cloudpayments-php-client

1. Go to this page and download the library: Download owlookit/cloudpayments-php-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/ */

    

owlookit / cloudpayments-php-client example snippets


$publicId = /*...*/;
$pass = /*...*/;
$apiClient = new \Owlookit\Cloudpayments\Library($publicId, $pass);
$response = $apiClient->paymentsCardsCharge(new \Owlookit\Cloudpayments\Request\CardsPayment(
    100,
    'RUB',
    '123.123.123.123',
    '01492500008719030128SMfLeYdKp5dSQVIiO5l6ZCJiPdel4uDjdFTTz1UnXY'
));

echo $response->success;

$apiClient = new \Owlookit\Cloudpayments\Library(\*...*\);
$apiClient->paymentsCardsCharge(\*...*\);

...
$validationUrl = 'https://apple-pay-gateway.apple.com/paymentservices/startSession';
$request = new \Owlookit\Cloudpayments\Request\ApplepayStartSession($validationUrl);
$apiClient->startSession($request);

try {
    ...
    $validationUrl = 'https://apple-pay-gateway.apple.com/paymentservices/startSession';
    $request = new \Owlookit\Cloudpayments\Request\ApplepayStartSession($validationUrl);
    ...
} catch (\Owlookit\Cloudpayments\Exceptions\BadTypeException $e) {
    var_dump($e->getMessage());
}

$hookData = new \Owlookit\Cloudpayments\Hook\HookPay($_POST);
echo $hookData->transactionId;

...
$apiClient = new \Owlookit\Cloudpayments\Library(\*...*\);
$apiClient->setIdempotency(true);
$apiClient->createPaymentByCard2Step(\*...*\);
...

composer