PHP code example of axcherednikov / cloudpayments-php-client

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

    

axcherednikov / cloudpayments-php-client example snippets


$publicId = /*...*/;
$pass = /*...*/;
$apiClient = new \Excent\Cloudpayments\Library($publicId, $pass);

$response = $apiClient->paymentsCardsCharge(new \Excent\Cloudpayments\Request\CardsPayment(
    100,
    'RUB',
    '123.123.123.123',
    '01492500008719030128SMfLeYdKp5dSQVIiO5l6ZCJiPdel4uDjdFTTz1UnXY'
));

echo $response->success;

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

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

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

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

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