PHP code example of checkout / checkout-sdk-php-beta

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

    

checkout / checkout-sdk-php-beta example snippets


$builder = CheckoutDefaultSdk::staticKeys();
$builder->setPublicKey("public_key");
$builder->setSecretKey("secret_key");
$builder->setEnvironment(Environment::sandbox()); // or production()
$builder->setHttpClientBuilder(); // optional, for a custom HTTP client
$defaultApi = $builder->build();

$paymentsClient = $defaultApi->getPaymentsClient();
$paymentsClient->refundPayment("payment_id");

$builder = CheckoutFourSdk::staticKeys();
$builder->setPublicKey("public_key");
$builder->setSecretKey("secret_key");
$builder->setEnvironment(Environment::sandbox()); // or production()
$builder->setHttpClientBuilder(); // optional, for a custom HTTP client
$fourApi = $builder->build();

$paymentsClient = $fourApi->getPaymentsClient();
$paymentsClient->refundPayment("payment_id");

$builder = CheckoutFourSdk::oAuth();
$builder->clientCredentials("client_id", "client_secret");
$builder->scopes([FourOAuthScope::$Files, FourOAuthScope::$Flow]); // array of scopes
$builder->setEnvironment(Environment::sandbox()); // or production()
$builder->setHttpClientBuilder(); // optional, for a custom HTTP client
$fourApi = $builder->build();

$paymentsClient = $fourApi->getPaymentsClient();
$paymentsClient->refundPayment("payment_id");
json
""php": ">=7.4",
    "checkout/checkout-sdk-php-beta": "version"
}