Amazon gift cards as referral program rewards with Incentives API & Voucherify
Tags: softwareaarchitecture, marketingtechnology, aws
Published: 2023-08-24 08:32:38

---
title: Amazon gift cards as referral program rewards with Incentives API & Voucherify
published: true
date: 2023-08-24 08:20:51 UTC
tags: softwareaarchitecture,marketingtechnology,aws
canonical_url: 
---

For better or for worse Amazon Gift Cards have become a standard in incentivizing customers and employees. Amazon Incentives API provides an easy and secure way of generating gift cards in real-time. Let’s see how we can make them a part of a referral program run with Voucherify.

### What you can build with Amazon Incentives API

The primary feature of the [Amazon Incentives API](https://developer.amazon.com/incentives-api) is to create virtual Amazon gift cards in real-time. But it enables a bunch of other interesting digital incentive scenarios too:

- Login And Receive — recharge a new or existing customer’s Amazon account when they log in (Amazon Login SDK necessary).
- Activate Physical Gift Cards — programmatically activate physical gift cards purchased in bulk earlier.
- Product Vouchers — create a gift card for a specific product category only (specs controlled by Amazon [here](https://developer.amazon.com/docs/incentives-api/product-voucher-codes.html)).

The API also provides some brick & mortar gift card activity capabilities, go to the [docs](https://developer.amazon.com/incentives-api) to learn more.

In this tutorial we’re going to cover real-time digital gift card generation which is a more secure and more convenient method to use them as referral rewards to buying gift cards in bulk.

### API & portal access

Only verified partners can access the Amazon Incentives API. Verified means that you have Amazon Incentives partner ID — this is different from AWS solution partner ID. You can get this by filling out this form [https://www.amazon-incentives.com/api/contact-us](https://www.amazon-incentives.com/api/contact-us) (For the Polish marketplace I waited ~2 weeks but it was a holiday season.)

Then, you can go to Step 2 of the [onboarding guide](https://developer.amazon.com/docs/incentives-api/onboarding-process.html#step-2---setting-up-the-amazon-incentives-api-portal).

### The first API call

**Note** : Here’s a [Postman collection](https://www.postman.com/ltvdev/workspace/ltv-dev/collection/841083-3e3ed22c-9d39-47c7-94b2-f514408348b4?action=share&creator=841083) with all API calls used in this tutorial.

Let’s test the API by creating a fake gift card within their Sandbox environment. We need three keys to authenticate a request: credentials and partner ID we obtained in the previous step.

To get credentials, go to /gc/corp/account/keys/, select Sandbox and create new access keys.

![](https://cdn-images-1.medium.com/max/1024/0*He5uZEx5sO75-e1m)

As with every Amazon service, the first step is to locate the right endpoint and region. For the Polish marketplace, the URL to Amazon Gift Codes On Demand (AGCOD) is [https://agcod-v2-eu-gamma.amazon.com](https://agcod-v2-eu-gamma.amazon.com/) and the region is eu-west-1. You can find the reference [here](https://developer.amazon.com/docs/incentives-api/incentives-api.html#sandbox-endpoints).

![](https://cdn-images-1.medium.com/max/1024/0*BlKSK74UiieFWi9C)

Also, any request needs to be signed with [Signature Version 4](https://docs.aws.amazon.com/IAM/latest/UserGuide/create-signed-request.html) algo. If you test the API with Postman, then you can configure it in the Authorization tab as shown below (apart from credentials, remember to provide the respective region and service name: AGCODService).

![](https://cdn-images-1.medium.com/max/1024/0*YavrSsWIYR72R7za)

According to the [spec](https://developer.amazon.com/docs/incentives-api/digital-gift-cards.html), we need to send the following payload to the /CreateGiftCard endpoint.

```
<CreateGiftCardRequest>
  <creationRequestId>YourPartnerIDTSpecTest001</creationRequestId>
  <partnerId>YourPartnerID</partnerId>
  <value>
    <currencyCode>PLN</currencyCode>
    <amount>10.00</amount>
  </value>
</CreateGiftCardRequest>
```

**Caveats** :

- currencyCode needs to match the currency set up in your Amazon Incentives API account.
- creationRequestId needs to start with your partner id as a prefix.

By invoking the request, you should get something like this:

```
<CreateGiftCardResponse>
  <gcClaimCode>GVFW-Y9DWGW-K5BQ</gcClaimCode>
  <cardInfo>
    <value>
      <amount>10.0</amount>
      <currencyCode>PLN</currencyCode>
    </value>
    <cardStatus>Fulfilled</cardStatus>
  </cardInfo>
  <gcId>4510447105517016</gcId>
  <creationRequestId>YourPartnerIDTSpecTest001</creationRequestId>
  <gcExpirationDate>Sun Aug 21 21:59:59 UTC 2033</gcExpirationDate>
  <status>SUCCESS</status>
</CreateGiftCardResponse>
```

Status Fulfilled means that the gift card certificate stored in gcClaimCode is ready to be shipped to the customer.

The developer portal should now be showing this:

![](https://cdn-images-1.medium.com/max/1024/0*XcS-7wFw4O4MBwF6)

### How to store gift cards

Actually, you don’t need to. The AGCOD CreateGiftCard operation is idempotent, so if the API receives more than one request with the same creationRequestId, only the first request will result in the creation of a new gift card, and all subsequent responses will return the same original gift card. They will not be treated as different transactions.

This means you can use your customer identifier (up to 40 alphanumeric chars) to differentiate gift cards. Keep in mind that the service is [rate-limited](https://developer.amazon.com/docs/incentives-api/incentives-api.html#throttle-rates) with 10 requests per second.

You can also import gift card codes to Voucherify. Importing them as regular codes will be helpful to track Amazon gift cards along with other rewards. The other way is to store them in a custom field in the Customer object.

### Testing & error handling

Because gift card API deals with money directly, your integration needs to be rock solid. Good news is that the AGCOD architects prepared a rock solid [test plan](https://developer.amazon.com/docs/incentives-api/test-plan.html) for your integration. The [error codes list](https://developer.amazon.com/docs/incentives-api/gift-codes-errors.html) is also well-documented.

![](https://cdn-images-1.medium.com/max/1024/0*uZliOfjX3bQUI8oi)

**Highlights** :

- In case of a mistake, you can cancel the gift card within 15 minutes after creation.
- You can simulate returning the error by any endpoint by providing a specific error code as a creationRequestId, e.g. F3003 will result in the endpoint returning F300 InsufficientFunds.
- Success response can be mocked by using mock code F0000.
- Six seconds is the recommended timeout for the client side application.
- If you suspect a bug at their end, the AGCOD team [describes](https://developer.amazon.com/docs/incentives-api/outage-management.html) how and when they want to be bothered.

You can monitor the available funds with the portal (/gc/corp/payments/notifications/), where you can also set up alerts for low balance:

![](https://cdn-images-1.medium.com/max/1024/0*LOHNlSz1vyDkVFsp)

Or you can call /GetAvailableFunds, Sandbox will always return 0 though.

```
<GetAvailableFundsResponse>
  <availableFunds>
    <amount>0.0</amount>
    <currencyCode>PLN</currencyCode>
  </availableFunds>
  <timestamp>20230821T154205Z</timestamp>
  <status>SUCCESS</status>
</GetAvailableFundsResponse>
```

### How to use Amazon Gift Cards in your referral program

Earlier this year, Taxfix, a prominent provider of tax filing services in Germany, introduced a two-sided referral program to increase their presence in the German market. Individuals who successfully referred their friends received Amazon gift cards as rewards. The Taxfix development team employed Voucherify and Braze to manage the program, and the operational process unfolded as follows:

![](https://cdn-images-1.medium.com/max/1024/0*ei1P1GTp5x_52NnM)

By utilizing Voucherify, they set up a customized referral program that allowed them to reward successful referrers with Amazon gift cards and invited friends with -50% discount codes on their first tax return with Taxfix.. With every referral code application, Voucherify would send a webhook notification to the Taxfix system.

![](https://cdn-images-1.medium.com/max/1024/0*DpdmUTT3xQmwjlyP)

![](https://cdn-images-1.medium.com/max/1024/0*AheCnCBhMJDLIqeA)

Next, they would call Amazon Incentives API to create rewards ($30 Amazon gift cards) for each successful referral.

The Taxfix team used Braze to divide their audience into different groups and prioritize those who were most engaged. They strategically encouraged these engaged users to refer more people by sending them push notifications and emails. The referral messages contained a deep link that took advocates to a specific view in the app, where they could find their personalized referral code.

![](https://cdn-images-1.medium.com/max/528/0*WAU4QabSmX9CoUv3)

![](https://cdn-images-1.medium.com/max/592/0*Mo_gDLLGXNfVr_fR)

![](https://cdn-images-1.medium.com/max/608/0*J7oA0d84nLJwKUNt)

So, to create an end-to-end referral reward experience, Taxfix:

- Generated referral codes in Voucherify.
- Defined the discount associated with the referral code.
- Defined a successful referral event — using the referral code during signup.
- Promoted referral program with Braze emails and push notifications including a deeplink to the referral view containing the referral code.
- When a referral event occured, they sent a webhook to the Taxfix backend system.
- Backend called the Amazon Incentives API to get a new gift card code and send it with a transactional email to the customer.

### Scaling and improvements

The scenario covers only a single marketplace. If you want to create gift cards for more countries, you need to get a partner ID for each supported country.

You can think of other rewards and incentive campaigns, both digital and brick and mortar. For instance, you can use [Product Vouchers](https://developer.amazon.com/docs/incentives-api/product-voucher-guide.html) to narrow down the gift scope to be applicable only to Education Assistance products or other [good cause](https://developer.amazon.com/docs/incentives-api/product-voucher-codes.html).

Another option is to replace Amazon gift cards with vouchers or discounts for your services. With Voucherify, you can manage [digital gift cards](https://www.voucherify.io/gift-cards) and other incentives within one platform.

If you want to discuss options or get some help, drop me a line.