<?php // make sure you place the purchasedat_sdk.php file is present on your server 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->withCheckout()->addItem(\PurchasedAt\Purchase\CheckoutItem::of(4, 'SKU_ITEM_1')->addName('en', 'Item 1')->addName('de', 'Gegenstand 1')->addPrice('EUR', '3.00')->addPrice('USD', '4.00'))->addItem(\PurchasedAt\Purchase\CheckoutItem::of(1, 'SKU_ITEM_2')->addName('en', 'Item 2')->addName('de', 'Gegenstand 2')->addPrice('EUR', '1.00')->addPrice('USD', '2.00'))->addTotal('EUR', '13.00')->addTotal('USD', '18.00'); // $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'); ?> <html> <body> <button data-purchasedat-widget-open style="border:none; padding: 0px; cursor: pointer; border-radius: 0px;"> <img src="purchasedat-buy-dark.png" alt="Buy with purchased.at!"> </button> <?php echo \PurchasedAt\renderScript($apiKey, $options); ?>
<?php // make sure you place the purchasedat_sdk.php file is present on your server 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; ?>
<?php // make sure you place the purchasedat_sdk.php file is present on your server 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'); ?> <html> <body> <button data-purchasedat-widget-open style="border:none; padding: 0px; cursor: pointer; border-radius: 0px;"> <img src="purchasedat-buy-dark.png" alt="Buy with purchased.at!"> </button> <?php echo \PurchasedAt\renderScript($apiKey, $options); ?> </body>