PHP code example of gifty / gifty-php
1. Go to this page and download the library: Download gifty/gifty-php 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/ */
gifty / gifty-php example snippets
$gifty = new \Gifty\Client\GiftyClient('eyJ0eXAi....');
$giftCard = $gifty->giftCards->get('ABCDABCDABCDABCD');
$gifty = new \Gifty\Client\GiftyClient('eyJ0eXAi....', ['api_headers' => [
'Accept-Language' => 'en',
'X-Gifty-Location' => 'lc_123456789'
]]);
$giftCard = $gifty->giftCards->get('ABCDABCDABCDABCD');
$locations = $gifty->locations->all();
$packages = $gifty->packages->all();
$package = $gifty->packages->get('gp_ABCDABCD');
$giftCard = $gifty->giftCards->get('ABCDABCDABCDABCD');
$transaction = $gifty->giftCards->issue(
'ABCDABCDABCDABCD',
[
"amount" => 1250,
"currency" => "EUR",
"promotional" => false
]
);
$transaction = $gifty->giftCards->redeem(
'ABCDABCDABCDABCD',
[
"amount" => 1250,
"currency" => "EUR",
"capture" => false
]
);
$transaction = $gifty->giftCards->extend(
'ABCDABCDABCDABCD',
[
"expires_at" => "2027-09-15T12:42:42+00:00"
]
);
$transactions = $gifty->transactions->all(['limit' => 5]);
$transactions = $gifty->transactions->all(['giftcard' => 'gc_123456789']);
$transaction = $gifty->transactions->get('tr_BV94pGgqRvgobxvrLX28jEl0');
$transaction = $gifty->transactions->capture('tr_BV94pGgqRvgobxvrLX28jEl0');
$transaction = $gifty->transactions->release('tr_BV94pGgqRvgobxvrLX28jEl0');
$transaction = $gifty->transactions->refund(
'tr_BV94pGgqRvgobxvrLX28jEl0',
[
"amount" => 1250,
"currency" => "EUR",
"reason" => "CUSTOMER_REQUEST",
"reason_description" => "Customer returned one item from the order"
]
);