PHP code example of parthenon / transaction-cloud

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

    

parthenon / transaction-cloud example snippets


$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");

// and if you want to use the sandbox

$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password", true);
 
$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");
$url = $transactionCloud->getUrlToManageTransactions("[email protected]");
 
$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");
$url = $transactionCloud->getUrlToAdmin();

$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");
$transactions = $transactionCloud->getTransactionsByEmail("[email protected]");

/** @var $transaction \TransactionCloud\Model\Transaction **/
foreach ($transactions as $transaction) {
    // Do something with transaction
}

$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");
$transaction = $transactionCloud->getTransactionById("TC-TR_xxyyxxx");

// do something with transaction.

$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");
$success = $transactionCloud->assignTransactionToEmail("TC-TR_xxyyxxx", "[email protected]");

$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");
$success = $transactionCloud->cancelSubscription("TC-TR_xxyyxxx");

$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");
$refundData = $transactionCloud->refundTransaction("TC-TR_xxyyxxx");

$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");
$transactions = $transactionCloud->fetchChangedTransactions();

/** @var $transaction \TransactionCloud\Model\ChangedTransaction **/
foreach ($transactions as $transaction) {
    // Do something with transaction
}

$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");
$success = $transactionCloud->markTransactionAsProcessed("TC-TR_xxyyxxx");

$price = \Brick\Money::of("100", "USD");

$product = new \TransactionCloud\Model\Product();
$product->setPrices([$price]);
$product->setDescription("Custom product");
$product->setPayload("Payload");
$product->settTansactionIdToMigrate("TC-PR_kdljfdskl");

$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");
$productData = $transacloudCloud->customizeProduct("TC-PR_kdjfde", $product);

// $productData instanceof \TransactionCloud\Model\ProductData

$transactionCloud = new \TransactionCloud\TransactionCloud::create("api_key", "api_key_password");

$url = $transactionCloud->getPaymentUrlForProduct("TC-TR_3jsd94");