PHP code example of genome / merchant

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

    

genome / merchant example snippets


use Genome\Merchant\MerchantAccountManager;

$merchantAccountLogin = "foo";  // Your merchant account login
$merchantAccountSecret = "baz"; // Your merchant account password

$accountManager = new MerchantAccountManager($merchantAccountLogin, $merchantAccountSecret);


$hppApiKey = 'xxx';
$hppApiSecret = 'yyy';

$hppManager = $accountManager->getHostedPaymentPageManager($hppApiKey, $hppApiSecret)


try {
    $hppManager->assertCallbackSignature(getallheaders(), file_get_contents('php://input'));
} catch (\Exception e) {
    // Signature assertion failed
}

$payment = new HostedPayment(
    "uniqueOrderId",
    "userId",
    "mcc",
    "eur",
    9.99
);

$redirectUrl = $hppManager->generateInitializationRedirectUrl($payment);