PHP code example of univapay / univapay-sdk-compat

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

    

univapay / univapay-sdk-compat example snippets


$client = new UnivapayClient($storeAppToken);

// Compat surface -- unchanged.
$charge = $client->createToken($paymentMethod)->createCharge(Money::USD(1000))->awaitResult();

// Native surface -- same engine, same auth, same connection settings.
$native = $client->native();
$chargesApi = $native->getChargesApi();

$options = new UnivapayClientOptions();
$options->deprecationNotices = true;
$client = new UnivapayClient($storeAppToken, $options);

$client->createCharge($tokenId, Money::USD(1000));
// -> E_USER_DEPRECATED: Univapay\Compat\UnivapayClient::createCharge() is a compatibility-layer
//    method; the native equivalent is ChargesApi::createCharge() via native(). See <guide-url>