kamerk22 / amazongiftcode
Laravel Package for Amazon Gift Codes.
Requires
- illuminate/support: ~5|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- orchestra/testbench: ^10.0|^11.0
- phpunit/phpunit: ^10.5|^11.0|^12.5.12
This package is auto-updated.
Last update: 2026-06-12 01:38:40 UTC
README
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.
Requirements
- 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.
Installation
You can install this package via Composer.
$ composer require kamerk22/amazongiftcode
Set 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_ID
The package will register itself automatically. Optionally publish config file of package
$ php artisan vendor:publish --provider="kamerk22\AmazonGiftCode\AmazonGiftCodeServiceProvider" --tag="config"
Usage
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();
Available Methods
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);
CreateGiftCard
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();
CancelGiftCard
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();
GetAvailableFunds
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();
Testing
$ composer test
The test suite runs against Laravel 12 and 13 on PHP 8.2 to 8.4 (Laravel 13 requires PHP 8.3+).
Change log
Please see the changelog for more information on what has changed recently.
Contributing
Please see contributing.md for details and a todolist.
Security
If you discover any security related issues, please email kashyapk62@gmail.com instead of using the issue tracker.
Credits
License
MIT. Please see the license file for more information.