PHP code example of gullevek / amazon-incentives

1. Go to this page and download the library: Download gullevek/amazon-incentives 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/ */

    

gullevek / amazon-incentives example snippets


use gullevek\AmazonIncentives\AmazonIncentives;
// buy a gift card with a value
$value = 500;
$aws_gc = AmazonIncentives::make()->buyGiftCard((float)$value);
// the two below are need if we want to cancel the card
// get gift card id (gcID)
$aws_gc->getId();
// get creation request id (creationRequestId)
$aws_gc->getCreationRequestId();
// the one below must be printed to the user
$aws_gc->getClaimCode();
// check status (SUCCESS/RESEND/FAILURE)
$aws_gc->getStatus();
// others:
// getAmount, getCurrency

// use getCreationRequestId() and getId() from request
$aws_gc = gullevek\AmazonIncentives\AmazonIncentives::make()->cancelGiftCard($creation_request_id, $gift_card_id);
// return is as above

$aws_gc = gullevek\AmazonIncentives\AmazonIncentives::make()->getAvailableFunds();

$exception_array = gullevek\AmazonIncentives\AmazonIncentives::decodeExceptionMessage($exception_message);

[
    'status' => 'AWS Status FAILURE or RESEND',
    'code' => 'AWS Error Code Fnnn',
    'type' => 'AWS Error info',
    'message' => 'AWS long error message',
    'log_id' => 'If logging is on the current log id',
    'log' => 'The complete log collected over all calls',
]