require_once 'purchasedat_sdk.php';
$apiKey = 'REPLACE_WITH_API_KEY';
// be sure to specify the customer's e-mail address (mandatory!)
$options = new \PurchasedAt\PurchaseOptions('*****@*****.**');
// test mode
$options->setTestEnabled(true);
// $options->setTestCountry('CH');
// $options->setTestLanguage('de');
// redirect url
// $options->setRedirectUrl('REPLACE_WITH_REDIRECT_URL');
// callback url (specify your api endpoint to receive transaction status change notifications)
// $options->setNotificationUrl('REPLACE_WITH_CALLBACK_URL');
// allow only a specific item to be purchased
// $options->setSelectItem('REPLACE_WITH_ITEM_ID');
$apiClient = new PurchasedAt\APIClient($apiKey);
$result = $apiClient->sessionEntryUrl($options);
if (!$result->success) {
    die('request failed: ' . $result->errorCode);
}
$entryUrl = $result->result->getEntryUrl();
?>

<html>
<body>

<a href="<?php 
echo $entryUrl;
?>
" target="_blank">Open purchased.at</a>

</body>