hayleyberryl2s / amazongiftcode
Laravel Package for Amazon Gift Codes.
Requires
- ext-curl: *
- ext-json: *
- illuminate/support: ~5|^6.0|^7.0|^8.0|^9.0|^10.0
Requires (Dev)
- mockery/mockery: ^1.1
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~7.0|~8.0
- sempro/phpunit-pretty-print: ^1.0
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.
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();
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.