AmazonGiftCode is Laravel package for Amazon Gift Codes On Demand (AGCOD). Integration for Amazon Incentive API. Read more at https://developer.amazon.com/amazon-incentives-api
This package will give you a simplest APIs to Create/Cancel Amazon Gift Code On Demand.
- PHP 8.2 or higher (PHP 8.3+ for Laravel 13)
- Laravel 12 or 13
Older Laravel versions (5 to 11) remain installable, but the test suite and CI target 12 and 13. Laravel 11 and below are past their security support window.
You can install this package via Composer.
$ composer require kamerk22/amazongiftcodeSet the following Environment Variable in .env file.
GIFT_CARD_ENDPOINT=agcod-v2-gamma.amazon.com
GIFT_CARD_KEY=AWS_ACCESS_KEY
GIFT_CARD_SECRET=AWS_SECRET
GIFT_CARD_PARTNER_ID=AWS_PARTNER_IDThe package will register itself automatically. Optionally publish config file of package
$ php artisan vendor:publish --provider="kamerk22\AmazonGiftCode\AmazonGiftCodeServiceProvider" --tag="config"To Create Amazon Gift Card
$aws = AmazonGiftCode::make()->buyGiftCard($value);Create a Amazon Gift Card with your own $creationRequestId (otherwise generated)
$aws = AmazonGiftCode::make()->buyGiftCard($value, $creationRequestId);To Cancel Amazon Gift Card
$aws = AmazonGiftCode::make()->cancelGiftCard($creationRequestId, $gcId);To Get Available Funds Balance
$aws = AmazonGiftCode::make()->getAvailableFunds();To change client configuration dynamic. If you pass only $key or other parameter will takes value from default config.
$aws = AmazonGiftCode::make($key, $secret, $partner, $endpoint, $currency)->buyGiftCard($value);getStatus()
Get the status of perform request. (status)
$status = $aws->getStatus();getId()
To get unique Amazon Gift Card id. (gcId)
$gcId = $aws->getId();getCreationRequestId()
Original Creation Request Id. (creationRequestId)
$creationRequestId = $aws->getCreationRequestId();getClaimCode()
Amazon Gift Card Claim Code to be used. (gcClaimCode)
$gcClaimCode = $aws->getClaimCode();getValue()
Amount of generated Gift Card. (amount)
$amount = $aws->getValue();getCurrency()
Currency Code of generated Gift Card. (currencyCode)
$currencyCode = $aws->getCurrency();getRawJson()
Get the raw JSON response. (original response)
$rawJson = $aws->getRawJson();getStatus()
Get the status of perform request. (status)
$status = $aws->getStatus();getId()
To get unique Amazon Gift Card id. (gcId)
$gcId = $aws->getId();getCreationRequestId()
Original Creation Request Id. (creationRequestId)
$creationRequestId = $aws->getCreationRequestId();getRawJson()
Get the raw JSON response. (original response)
$rawJson = $aws->getRawJson();getStatus()
Get the status of perform request. (status)
$status = $aws->getStatus();getAmount()
To get available balance amount. (amount)
$amount = $aws->getAmount();getCurrency()
To get currency. (currency)
$currency = $aws->getCurrency();getTimestamp()
Get request timestamp. (getTimestamp)
$timestamp = $aws->getTimestamp();getRawJson()
Get the raw JSON response. (original response)
$rawJson = $aws->getRawJson();$ composer testThe test suite runs against Laravel 12 and 13 on PHP 8.2 to 8.4 (Laravel 13 requires PHP 8.3+).
Please see the changelog for more information on what has changed recently.
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email kashyapk62@gmail.com instead of using the issue tracker.
MIT. Please see the license file for more information.
