PHP code example of kasp3r / gifty
1. Go to this page and download the library: Download kasp3r/gifty 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/ */
kasp3r / gifty example snippets
use Gifty\GiftyService;
$giftyService = new GiftyService('customerKey', 'customerSecret', 'userId');
$response = $giftyService
->setTesting(true) // to enable testing
->createGift('productId', 'templateId', 'recipient');
if ($response->isError()) {
echo $response->getErrorCode() . ': ' . $response->getErrorDescription();
} else {
echo 'Gift name: ' . $response->getGiftName();
echo 'Gift code: ' . $response->getGiftCode();
// ...
}