amazon gift codes on demand web...

40
Amazon Gift Codes On Demand Web Creation Integration Technical Specification FAQ and Appendices Amazon Gift Codes On Demand (AGCOD) is a set of systems designed to allow partners and third party developers to create and distribute Amazon gift codes in real-time, on demand. Examples include: Applicable use cases include inserting gift codes into electronic gift cards, group gifting, real time redemption of gift codes in loyalty programs (i.e. points programs), etc.

Upload: others

Post on 15-Feb-2020

37 views

Category:

Documents


2 download

TRANSCRIPT

Amazon Gift Codes On Demand Web Creation

Integration Technical Specification

FAQ and Appendices

Amazon Gift Codes On Demand (AGCOD) is a set of systems designed to allow partners and third party developers to create and distribute Amazon gift codes in real-time, on demand. Examples include: Applicable use cases include inserting gift codes into electronic gift cards, group gifting, real time redemption of gift codes in loyalty programs (i.e. points programs), etc.

Page 2

Contents FAQ .............................................................................................................................................................................. 4

Appendix-1: High Level AGCOD Gateway Service Architecture ............................................................ 8

Appendix-2: AGCOD Gateway Service message schematics ................................................................... 9

Appendix-3: Basic flow for Gift Code Creation/Cancel request ......................................................... 10

Appendix-4: Sample Code and Sample Requests/Responses ............................................................. 10

Sample code .......................................................................................................................................... 10

1. Create Gift Card .............................................................................................................................. 13

Sample CreateGiftCard HTTP POST request with JSON payload ................................................... 13

Sample CreateGiftCard HTTP POST request with XML payload .................................................... 14

Sample CreateGiftCard Response format ........................................................................................ 15

2. Cancel Gift Card .............................................................................................................................. 16

Sample CancelGiftCard HTTP POST request with JSON payload ................................................... 16

Sample CancelGiftCard HTTP POST request with XML payload .................................................... 17

Sample CancelGiftCard Response format ........................................................................................ 18

3. Get Gift Card Activity Page .............................................................................................................. 19

Sample GetGiftCardActivityPage HTTP POST request with JSON payload ................................... 19

Sample GetGiftCardActivityPage HTTP POST request with XML payload .................................... 20

Sample GetGiftCardActivityPage Response format ........................................................................ 21

4. Mocking Test Examples ................................................................................................................... 26

SUCCESS Mocking test with requestId "F0000" .............................................................................. 26

FAILURE Mocking test with requestId “F2005” .............................................................................. 27

5. Known-answer V4 Signature Example ............................................................................................ 28

Appendix-5: Card Status ................................................................................................................................... 30

Appendix-7: Sandbox and Production Endpoints ................................................................................... 31

Appendix-8: Throttle Rates ............................................................................................................................. 31

Page 3

Appendix-9: Error Handling ........................................................................................................................... 32

Appendix-10: Error Codes ............................................................................................................................... 33

Page 4

FAQ

Q.1 I am getting “javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target” error when I run the sample code?

A.1 This might be caused by not having the “VeriSign Class 3 Public Primary Certificate Authority –

G5” and/or “Verisign Class 3 Secure Server CA – G3” CA cert, (see screenshot below) which is the

root/intermediate CA signer of the SSL cert used at our endpoints, in your Java keystore.

The cert should be automatically populated when you install JRE/JDK on the machine where

Eclipse (or other IDE) is installed. You can use the built-in Java keytool (only available in JDK, not

JRE) to import the cert to the Java keystore or run the sample code from a different machine

with the root/intermediate CA signer cert installed. Importing CA cert is outside the scope of

AGCOD support. Reference the links below for more additional information. Also, consult your

Java/Eclipse documentation if you need additional help on the following methods.

Method 1 - this method may be challenging, but has proven to resolve the issue.

http://javarevisited.blogspot.com/2012/03/add-list-certficates-java-keystore.html http://wiki.eclipse.org/Generating_a_Private_Key_and_a_Keystore

Page 5

Method 2 – may be easier for you

Alternatively, you can import the cert to the Java keystore using an Eclipse plug-in call keytool

http://keytool.sourceforge.net/installing.html or

http://sourceforge.net/projects/keytool/?source=pdlp

Once the plug-in is installed, configure the keystore location (your keystore location might vary

depending on your OS or location of your keystore). Default keystore password is “Changeit”

(without double quotes).

Q.2 I am getting “ <Message>The security token included in the request is invalid.</Message>” error.

A.2 This might be caused by an invalid security access key. Verify that your access key is correct, that it is for the correct environment (Sandbox vs. Production), and confirm the locale for the endpoint being used.

Q.3 I am getting “The String-to-Sign should have been 'AWS4-HMAC-SHA256/…./us-east-1/AGCODService/aws4_request…..'” error.

A.3 This might be caused by an invalid access key. Verify that access key is correct, that it is for the

correct environment (Sandbox vs. Production), and confirm the locale for the endpoint being

used. Also, make sure to prefix the key qualifier “AWS4” to the secret key when constructing the

derived signing key (kSecret) per http://docs.aws.amazon.com/general/latest/gr/sigv4-

calculate-signature.html.

Q.4 I am getting “F500” error.

A.4 Contact [email protected]; include your Partner ID so that our developers can

easily identify your account. In your communication please provide as much of the following

information as possible (as applicable).

Complete Request/Response pair of your call to the AGCOD Gateway

Complete endpoint URL used (including the Server URL) to make the request

The StringToSign used in the request, if not already in the Request/Response above

The corresponding signature of the StringToSign used, if not already in the Request/Response above

Approximate time (with time zone) of your request (the time zone that is configured on the machine issuing the above request)

Programming language used

Any recent changes (both programming and infrastructure) on your end

Screenshot of error

Partner’s technical contact email/phone #

Partner’s time zone

Q.5 I am getting “<Message>Missing Authentication Token</Message>” error.

A.5 This might be caused by specifying the wrong endpoint (e.g., https://agcod-v2.amazon.com instead of https://agocd-v2-gamma.amazon.com or the appropriate endpoint for your locale).

Page 6

Verify the endpoint being used is accurate and it is for the correct environment (Sandbox vs. Production) and locale.

Q.6 I am getting “HTTP Status 400 - There was an error while processing the request. The request does not match any of the supported protocols.” error?

A.6 This is often caused by making a request to the incorrect endpoint. Verify you are using the

correct endpoint.

Q.7 What info from the API do I need to retain for future reference?

A.7 At a minimum, creationRequestId, amount, currency, for the CreateGiftCard API needed to be

recorded for future operations such as CancelGiftCard. Without this info, you will not be able to

complete the CancelGiftCard call for the same gcCreationRequestId if the required

aforementioned parameters are not provided.

Q.8 I cannot get the signature to work.

A.8 Please check the following common coding errors here:

http://docs.aws.amazon.com/general/latest/gr/signature-v4-examples.html

Common coding errors could be:

Inadvertently swapping the key and the data when calculating intermediary keys. The

result of the previous step's computation is the key, not the data. Check the

documentation for your cryptographic primitives carefully to ensure that you place the

parameters in the proper order.

Forgetting to prepend the string "AWS" in front of the key for the first step. It is possible

to implement the key derivation using a “for loop” or iterator. When you do, do not

forget to special-case the first iteration so that it includes the "AWS" string.

Forgetting to use the asBytes option for the JavaScript HMAC.Crypto function. If you do

not use the asBytes option, the HMAC implementation will perform an additional hex

encoding by default.

Make sure the query string in your request is both properly sorted and encoded, the

header names have been converted to lowercase characters and the headers have been

sorted by character code (http://docs.aws.amazon.com/general/latest/gr/sigv4-create-

canonical-request.html).

Q.9 Does the AGCOD Gateway support GET?

A.9 No, only POST is supported

Q.10 I get “Request Id Must Start With Partner Name” error, but I checked and have the correct Partner Name?

Page 7

A.10 Partner ID is case sensitive. Also, make sure the endpoint/locale is correct (Sandbox vs.

Production and NA vs. EU)

Q.11 Does the AGCOD Gateway support SOAP or Query?

A.11 No, it only supports RESTfull requests

Q.12 Is there any limit on the time between when a CreateGiftCard() is made and when a CancelGiftCard () will be accepted?

A.12 There is currently no time limit; the limitation is by use case, meaning a create cannot be issued

after a usage transaction (e.g. claimed) has been processed for the GC (example: claimed by

your end customer). In addition, a GC cannot be cancelled past its expiration date (US GCs have

no expiration date, however GCs in other regions may have an expiration date. (Check with your

Account Manager if expiration date is applicable in your region).

Q.13 What happens if there are not sufficient funds in the account to cover a request?

A.13 If there are not sufficient funds, the AGCOD Gateway will return an F300 error and not activate the gift card. It is important that you accurately forecast your Gift Card volumes and maintain a contingency for unanticipated demand. Work with your Account Manager to determine the best approach.

Q.14 I get “F300 Issuance Cap Exceeded” error when I try to create a GC

A.14 This might be caused by the Issuance Cap being exceeded for non-FPS prepay partners if nothing else has changed on the partner’s side. If you are receiving this error in Production it is likely related to exceeding the amount of funds you have in your account. To find out more contact your Account Manager. If you are receiving this error in Sandbox contact [email protected] to assist you further.

Q.15 I get “Max Amount Exceeded” error when I try create a GC

A.15 Make sure the amount of the GC you are activating does not exceed $2,000 in the US as restricted by law (other countries might have a different limit).

Country US CA UK DE FR IT ES CN JP

Denom $0.01 - $2,000

$0.01 -$5,000

£ 0,01 - £ 5,000

€ 0,01 - € 5,000

€ 0,01 - € 5,000

€ 0,01 - € 5,000

€ 0,01 - € 5,000

¥ 1 RMB - ¥ 1,000 RMB

¥ 1 -

¥ 500,000

JPY

Q.16 Does the AGCOD Gateway provide a response/How do I specify the format of the request in JSON or XML using the Java Sample code?

A.16 Yes, select the corresponding (XML or JSON) format by commenting on the line of the non-preferred format.

Page 8

Q.17 I am getting “F200 Invalid Request” error.

A.17 This is often caused by making an idempotent AGCOD Create GC call (using a previously used

CreationRequestID) with a different amount than the original request.

Q.18 I am getting “Credential should be scoped to a valid region, not 'us-east-1'.” error.

A.18 Check Appendix 6 for the correct endpoint/region used in your code.vb

Q.19 I’m getting a lot of F500/F200 errors, but I cannot figure out what’s wrong on my side. What’s going on?

A.19 F500 errors are usually caused by timeouts on the Amazon side. If you seeing a regular occurrence of these contact [email protected]. F200 errors are usually a result of a submission that contains invalid information. If the information being submitted has been verified, and looks correct contact [email protected] for assistance.

Appendix-1: High Level AGCOD Gateway Service Architecture

Page 9

Appendix-2: AGCOD Gateway Service message schematics

Page 10

Appendix-3: Basic flow for Gift Code Creation/Cancel request

Appendix-4: Sample Code and Sample Requests/Responses

Sample code

To assist you with implementing your solution we have provided sample code (Java , C#, Python, Ruby,

PHP, HTML) that contains the core AGCOD API functions. The sample code does not have good error

handling therefore it is not “Production Ready”; they should only be used as a guide.

NOTE: You can disregard any references to X.509 Certificate handling you found on the Amazon AWS

website. Our systems no longer require X.509 Certificates for authenticating. Your access keys and

calculated signature is sufficient.

The sample code is for illustration of the API functionality only, it does not have any logic to handle

errors introduced by the user/system. Additionally, the Secret Key / Access Key/ PartnerId are in the

source code, which might get compromise should an unhandled error occur that leads to a non-

deterministic behavior in the program.

Page 11

Provide the following parameters using your own specific values prior to testing

partnerId - Acme1 currencyCode – USD for US, EUR for EU, JPY for JP, CNY for CN, CAD for CA, AUD for AU agcodAccessKey - AKIAJE2RAAV7RP2WROKA (not valid, example only) agcodSecretKey - Vgjd4AjpU0Sm6IYNDjRRX9nZOA+VPxwaF5K43G9K (not valid, example only) region – us-east-1 (will vary depending on location and environment – see regions and endpoints) endpoint - (will vary depending on location and environment – see regions and endpoints) C# - the App.config in the sample code contains all the specific parameters

Java parameters //User and instance parameters private static final String accessKeyID = ""; // Your access key ID private static final String accessSecretKey = ""; // Your secret key //Payload parameters private static final String partnerID = ""; private static final String requestID = ""; private static final String currencyCode = ""; // USD for US, EUR for EU, JPY for JP, CNY for CN, CAD for CA //Additional payload parameters for CancelGiftCard private static final String gcId = ""; // the GC ID from a Create call made previously

Page 12

Python parameters

Ruby Paramers

Page 13

Note: The examples below were created using an Amazon test account, partners should use their own

access identifiers (accessKeyID, partnerID, requestID).

1. Create Gift Card

Sample CreateGiftCard HTTP POST request with JSON payload

PAYLOAD:

{"creationRequestId": "AwssbTSpecTest001", "partnerId": "Awssb", "value":

{"currencyCode": "USD", "amount": 1.00}}

HASHED PAYLOAD:

6193dc333ef1db9edae1f17989c71ce5f1939706a79be5bb924fc2e92bc23961

CANONICAL REQUEST:

POST

/CreateGiftCard

accept:application/json

content-type:application/json

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T222620Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

accept;content-type;host;x-amz-date;x-amz-target

6193dc333ef1db9edae1f17989c71ce5f1939706a79be5bb924fc2e92bc23961

HASHED CANONICAL REQUEST:

447277eb7144a2280508b8bf047706381beb832306a5b28ee0bb69a00b9bde0d

STRING TO SIGN:

AWS4-HMAC-SHA256

20130910T222620Z

20130910/us-east-1/AGCODService/aws4_request

447277eb7144a2280508b8bf047706381beb832306a5b28ee0bb69a00b9bde0d

DERIVED SIGNING KEY:

48428b0d3bd97f08fbefc9d675975d7d914788ee3bc509ae27decf874f16921b

SIGNATURE:

66872de215ae457cd978a49be377caf7cd3b5ab2914785339c2b8242e3631a71

ENDPOINT:

agcod-v2-gamma.amazon.com

SIGNED REQUEST

POST /CreateGiftCard HTTP/1.1

accept:application/json

content-type:application/json

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T222620Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

Authorization:AWS4-HMAC-SHA256 Credential=AKIAJBYCL67O6NJUNYBQ/20130910/us-

east-1/AGCODService/aws4_request, SignedHeaders=accept;content-type;host;x-

Page 14

amz-date;x-amz-target,

Signature=66872de215ae457cd978a49be377caf7cd3b5ab2914785339c2b8242e3631a71

{"creationRequestId": "AwssbTSpecTest001", "partnerId": "Awssb", "value":

{"currencyCode": "USD", "amount": 1.00}}

Sample CreateGiftCard HTTP POST request with XML payload

PAYLOAD:

<CreateGiftCardRequest><creationRequestId>AwssbTSpecTest001</creationRequestI

d><partnerId>Awssb</partnerId><value><currencyCode>USD</currencyCode><amount>

1.00</amount></value></CreateGiftCardRequest>

HASHED PAYLOAD:

e0d405956e60622bee7a1161b179f7b77149cd0e43f389b0baad8ea9fc8503e0

CANONICAL REQUEST:

POST

/CreateGiftCard

accept:application/x-www-form-urlencoded; charset=UTF-8

content-type:application/x-www-form-urlencoded; charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T221949Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

accept;content-type;host;x-amz-date;x-amz-target

e0d405956e60622bee7a1161b179f7b77149cd0e43f389b0baad8ea9fc8503e0

HASHED CANONICAL REQUEST:

4378e45d89236494f3321d3690cf624f0e3fe91d22bdf1bf0a0a6cde85fd86eb

STRING TO SIGN:

AWS4-HMAC-SHA256

20130910T221949Z

20130910/us-east-1/AGCODService/aws4_request

4378e45d89236494f3321d3690cf624f0e3fe91d22bdf1bf0a0a6cde85fd86eb

DERIVED SIGNING KEY:

48428b0d3bd97f08fbefc9d675975d7d914788ee3bc509ae27decf874f16921b

SIGNATURE:

6dce900ea3557473ee750dfe11489dc667366ffc8823541fadf13934e5d64790

ENDPOINT:

agcod-v2-gamma.amazon.com

SIGNED REQUEST

POST /CreateGiftCard HTTP/1.1

accept:application/x-www-form-urlencoded; charset=UTF-8

content-type:application/x-www-form-urlencoded; charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T221949Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

Authorization:AWS4-HMAC-SHA256 Credential=AKIAJBYCL67O6NJUNYBQ/20130910/us-

east-1/AGCODService/aws4_request, SignedHeaders=accept;content-type;host;x-

Page 15

amz-date;x-amz-target,

Signature=6dce900ea3557473ee750dfe11489dc667366ffc8823541fadf13934e5d64790

<CreateGiftCardRequest><creationRequestId>AwssbTSpecTest001</creationRequestI

d><partnerId>Awssb</partnerId><value><currencyCode>USD</currencyCode><amount>

1.00</amount></value></CreateGiftCardRequest>

Sample CreateGiftCard Response format

JSON {"cardInfo":{"cardNumber":null,"cardStatus":"RefundedToPurchaser","expirationDate":null,"value":{"amount":1.0,"currencyCode":"USD"}},"creationRequestId":"AwssbTSpecTest001","gcClaimCode":"Z7NV-LBBG39-75MU","gcExpirationDate":null,"gcId":"A2GCN9BRX5QS76","status":"SUCCESS"} XML RESPONSE: <CreateGiftCardResponse> <creationRequestId>AwssbTSpecTest001</creationRequestId> <cardInfo> <value> <amount>1.0</amount> <currencyCode>USD</currencyCode> </value> <cardStatus>Fulfilled</cardStatus> </cardInfo> <status>SUCCESS</status> <gcId>A2GCN9BRX5QS76</gcId> <gcClaimCode>Z7NV-LBBG39-75MU</gcClaimCode> </CreateGiftCardResponse>

Required parameters

Please note that the currency value (USD, GBP, EUR, JPY, CNY) might vary based on your locale

1 HTTP Request Method=POST

2 Canonical URI=/CreateGiftCard

3 Canonical Query String=’’ (empty string)

4 Canonical Headers=

accept:application/json

content-type:application/json

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T222620Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

Page 16

or

content-type:application/x-www-form-urlencoded; charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T221949Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

5 SignedHeaders=content-type;host;x-amz-date;x-amz-target

6 Algorithm= AWS4-HMAC-SHA256

7 Request Date=20130910T221949Z

8 CredentialScope=20130910/us-east-1/AGCODService/aws4_request

9 Service Name=AGCODService

10 Creation Request Id= AwssbTSpecTest001

11 Host= agcod-v2-gamma.amazon.com (use applicable endpoint)

12 Region Name=us-east-1 (use applicable endpoint)

13 Partner Id=Awssb (use your own Partner ID)

14 Amount=1

15 Currency Code=USD

2. Cancel Gift Card

Sample CancelGiftCard HTTP POST request with JSON payload

PAYLOAD:

{"creationRequestId": "AwssbTSpecTest001", "partnerId": "Awssb", "gcId":

"A2GCN9BRX5QS76"}

HASHED PAYLOAD:

7492d98f807281c82b8abef76b75398d72bf4265c8a7ea1726b5cbee0a39be9d

CANONICAL REQUEST:

POST

/CancelGiftCard

accept:application/json

content-type:application/json

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T222545Z

x-amz-target:com.amazonaws.agcod.AGCODService.CancelGiftCard

Page 17

accept;content-type;host;x-amz-date;x-amz-target

7492d98f807281c82b8abef76b75398d72bf4265c8a7ea1726b5cbee0a39be9d

HASHED CANONICAL REQUEST:

0488271c96d8657cd9b4dade4a2e6f357b4fa1c4666d4a14f3c02cbe2d6d6a9b

STRING TO SIGN:

AWS4-HMAC-SHA256

20130910T222545Z

20130910/us-east-1/AGCODService/aws4_request

0488271c96d8657cd9b4dade4a2e6f357b4fa1c4666d4a14f3c02cbe2d6d6a9b

DERIVED SIGNING KEY:

48428b0d3bd97f08fbefc9d675975d7d914788ee3bc509ae27decf874f16921b

SIGNATURE:

7c27005003a87310297d588749efdd5203deabed8610fafe8ba8e82f0e759949

ENDPOINT:

agcod-v2-gamma.amazon.com

SIGNED REQUEST

POST /CancelGiftCard HTTP/1.1

accept:application/json

content-type:application/json

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T222545Z

x-amz-target:com.amazonaws.agcod.AGCODService.CancelGiftCard

Authorization:AWS4-HMAC-SHA256 Credential=AKIAJBYCL67O6NJUNYBQ/20130910/us-

east-1/AGCODService/aws4_request, SignedHeaders=accept;content-type;host;x-

amz-date;x-amz-target,

Signature=7c27005003a87310297d588749efdd5203deabed8610fafe8ba8e82f0e759949

{"creationRequestId": "AwssbTSpecTest001", "partnerId": "Awssb", "gcId":

"A2GCN9BRX5QS76"}

Sample CancelGiftCard HTTP POST request with XML payload

PAYLOAD:

<CancelGiftCardRequest><creationRequestId>AwssbTSpecTest001</creationRequestI

d><partnerId>Awssb</partnerId><gcId>A2GCN9BRX5QS76</gcId></CancelGiftCardRequ

est>

HASHED PAYLOAD:

bea0ab33efe45db874d639de92b3b286353c7f2d494e20889d70f02d9574316d

CANONICAL REQUEST:

POST

/CancelGiftCard

accept:application/x-www-form-urlencoded; charset=UTF-8

content-type:application/x-www-form-urlencoded; charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T222449Z

x-amz-target:com.amazonaws.agcod.AGCODService.CancelGiftCard

Page 18

accept;content-type;host;x-amz-date;x-amz-target

bea0ab33efe45db874d639de92b3b286353c7f2d494e20889d70f02d9574316d

HASHED CANONICAL REQUEST:

8b9e30824d9aaf2539caa2e56519475185fda4850f138db66b7fe4c223618e11

STRING TO SIGN:

AWS4-HMAC-SHA256

20130910T222449Z

20130910/us-east-1/AGCODService/aws4_request

8b9e30824d9aaf2539caa2e56519475185fda4850f138db66b7fe4c223618e11

DERIVED SIGNING KEY:

48428b0d3bd97f08fbefc9d675975d7d914788ee3bc509ae27decf874f16921b

SIGNATURE:

0bef87e8b01aec57fca532e79a5819fcc55d3c02cfafcdf08495ed4a26d0cd87

ENDPOINT:

agcod-v2-gamma.amazon.com

SIGNED REQUEST

POST /CancelGiftCard HTTP/1.1

accept:application/x-www-form-urlencoded; charset=UTF-8

content-type:application/x-www-form-urlencoded; charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T222449Z

x-amz-target:com.amazonaws.agcod.AGCODService.CancelGiftCard

Authorization:AWS4-HMAC-SHA256 Credential=AKIAJBYCL67O6NJUNYBQ/20130910/us-

east-1/AGCODService/aws4_request, SignedHeaders=accept;content-type;host;x-

amz-date;x-amz-target,

Signature=0bef87e8b01aec57fca532e79a5819fcc55d3c02cfafcdf08495ed4a26d0cd87

<CancelGiftCardRequest><creationRequestId>AwssbTSpecTest001</creationRequestI

d><partnerId>Awssb</partnerId><gcId>A2GCN9BRX5QS76</gcId></CancelGiftCardRequ

est>

Sample CancelGiftCard Response format

JSON {"creationRequestId":"AwssbTSpecTest001","gcId":"A2GCN9BRX5QS76","status":"SUCCESS"} XML <CancelGiftCardResponse> <creationRequestId>AwssbTSpecTest001</creationRequestId> <status>SUCCESS</status> <gcId>A2GCN9BRX5QS76</gcId> </CancelGiftCardResponse>

Required parameters

Page 19

Please note that the currency value (USD, GBP, EUR, JPY, CNY, AUD) might vary based on your locale

1 HTTP Request Method=POST

2 Canonical URI=/CancelGiftCard

3 Canonical Query String=’’ (empty string)

4 Canonical Headers=

accept:application/json

content-type:application/json

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T222545Z

x-amz-target:com.amazonaws.agcod.AGCODService.CancelGiftCard

or

accept:application/x-www-form-urlencoded; charset=UTF-8

content-type:application/x-www-form-urlencoded; charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20130910T222449Z

x-amz-target:com.amazonaws.agcod.AGCODService.CancelGiftCard

5 SignedHeaders=content-type;host;x-amz-date;x-amz-target

6 Algorithm= AWS4-HMAC-SHA256

7 Request Date=20130910T222449Z

8 CredentialScope=20130910/us-east-1/AGCODService/aws4_request

9 Service Name=AGCODService

10 Creation Request Id= AwssbTSpecTest001

11 Host= agcod-v2-gamma.amazon.com (use applicable endpoint)

12 Region Name=us-east-1 (use applicable endpoint)

13 Partner Id=Awssb (use your own Partner ID)

3. Get Gift Card Activity Page

Sample GetGiftCardActivityPage HTTP POST request with JSON payload

PAYLOAD:

{ "requestId": "AwssbGetGCAPTest001", "partnerId": "Awssb", "utcStartDate":

"2015-08-12T00:00:00Z", "utcEndDate": "2015-08-14T00:00:00Z", "pageIndex": 0,

"pageSize": 200, "showNoOps": "true" }

Page 20

HASED PAYLOAD:

d695dfd48d1a24a432944c300195b88289c2e5b08b51dcc94f2f5c970be9537c

CANONICAL REQUEST:

POST

/GetGiftCardActivityPage

accept:application/json

host:agcod-v2-gamma.amazon.com

x-amz-date:20150813T185911Z

x-amz-target:com.amazonaws.agcod.AGCODService.GetGiftCardActivityPage

accept;host;x-amz-date;x-amz-target

d695dfd48d1a24a432944c300195b88289c2e5b08b51dcc94f2f5c970be9537c

HASHED CANONICAL REQUEST:

84beb4cdd987711a97e0d16aefa628242a311e420d45ac0934376ceddf6c3c56

STRING TO SIGN:

AWS4-HMAC-SHA256

20150813T185911Z

20150813/us-east-1/AGCODService/aws4_request

84beb4cdd987711a97e0d16aefa628242a311e420d45ac0934376ceddf6c3c56

DERIVED SIGNING KEY:

d3865217232a7551b34bec959eb925e09b9dda1f21247d72627f5ed83e0f1c5e

SIGNATURE:

81b04b1e06872fd108955e2d72f96f4bebfc00d3c1b9710a71b7a40b091e8fa5

SIGNED REQUEST:

POST /GetGiftCardActivityPage HTTP/1.1

accept:application/json

host:agcod-v2-gamma.amazon.com

x-amz-date:20150813T185911Z

x-amz-target:com.amazonaws.agcod.AGCODService.GetGiftCardActivityPage

Authorization: AWS4-HMAC-SHA256 Credential=AKIAJBYCL67O6NJUNYBQ/20150813/us-

east-1/AGCODService/aws4_request, SignedHeaders=accept;host;x-amz-date;x-amz-

target,

Signature=81b04b1e06872fd108955e2d72f96f4bebfc00d3c1b9710a71b7a40b091e8fa5

{ "requestId": "AwssbGetGCAPTest001", "partnerId": "Awssb", "utcStartDate":

"2015-08-12T00:00:00Z", "utcEndDate": "2015-08-14T00:00:00Z", "pageIndex": 0,

"pageSize": 200, "showNoOps": "true" }

Sample GetGiftCardActivityPage HTTP POST request with XML payload

PAYLOAD:

<GetGiftCardActivityPageRequest><requestId>AwssbGetGCAPTest001</requestId><pa

rtnerId>Awssb</partnerId><utcStartDate>2015-08-

12T00:00:00Z</utcStartDate><utcEndDate>2015-08-

14T00:00:00Z</utcEndDate><pageIndex>0</pageIndex><pageSize>200</pageSize><sho

wNoOps>true</showNoOps></GetGiftCardActivityPageRequest>

Page 21

HASED PAYLOAD:

a2dabf6010db209b2c3c18b3cb7cd302e73b49dca6831b2c53cc600cd9d7d5fe

CANONICAL REQUEST:

POST

/GetGiftCardActivityPage

accept:charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20150813T190248Z

x-amz-target:com.amazonaws.agcod.AGCODService.GetGiftCardActivityPage

accept;host;x-amz-date;x-amz-target

a2dabf6010db209b2c3c18b3cb7cd302e73b49dca6831b2c53cc600cd9d7d5fe

HASHED CANONICAL REQUEST:

5962eba9a045d676cc13f1b299e8d684c66a8be2aa39ecddb680cda9dfad5a2a

STRING TO SIGN:

AWS4-HMAC-SHA256

20150813T190248Z

20150813/us-east-1/AGCODService/aws4_request

5962eba9a045d676cc13f1b299e8d684c66a8be2aa39ecddb680cda9dfad5a2a

DERIVED SIGNING KEY:

d3865217232a7551b34bec959eb925e09b9dda1f21247d72627f5ed83e0f1c5e

SIGNATURE:

01458579fc637edc45f1d94482691ff924e189d0e289e99857619a195d6df2fb

SIGNED REQUEST:

POST /GetGiftCardActivityPage HTTP/1.1

accept:charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20150813T190248Z

x-amz-target:com.amazonaws.agcod.AGCODService.GetGiftCardActivityPage

Authorization: AWS4-HMAC-SHA256 Credential=AKIAJBYCL67O6NJUNYBQ/20150813/us-

east-1/AGCODService/aws4_request, SignedHeaders=accept;host;x-amz-date;x-amz-

target,

Signature=01458579fc637edc45f1d94482691ff924e189d0e289e99857619a195d6df2fb

<GetGiftCardActivityPageRequest><requestId>AwssbGetGCAPTest001</requestId><pa

rtnerId>Awssb</partnerId><utcStartDate>2015-08-

12T00:00:00Z</utcStartDate><utcEndDate>2015-08-

14T00:00:00Z</utcEndDate><pageIndex>0</pageIndex><pageSize>200</pageSize><sho

wNoOps>true</showNoOps></GetGiftCardActivityPageRequest>

Sample GetGiftCardActivityPage Response format

JSON

Page 22

{"cardActivityList":[{"activityStatus":"Success","activityTime":"Thu Aug 13 18:46:21 UTC 2015","activityType":"GCCreation","cardNumber":null,"cardValue":{"amount":10.0,"currencyCode":"USD"},"failureCode":null,"gcId":"A3Q7TCFUJ5LS5Q","isRealOp":"false","partnerId":"Awssb","requestId":"Awssb0829140906AM"},{"activityStatus":"Success","activityTime":"Thu Aug 13 18:46:41 UTC 2015","activityType":"GCCreation","cardNumber":null,"cardValue":{"amount":10.0,"currencyCode":"USD"},"failureCode":null,"gcId":"A1AR2XOII0L9DE","isRealOp":"false","partnerId":"Awssb","requestId":"Awssb0829141507PM"},{"activityStatus":"Success","activityTime":"Thu Aug 13 18:47:05 UTC 2015","activityType":"GCCreation","cardNumber":null,"cardValue":{"amount":10.0,"currencyCode":"USD"},"failureCode":null,"gcId":"A1CRLBZ838H2PT","isRealOp":"false","partnerId":"Awssb","requestId":"Awssb0829141556PM"},{"activityStatus":"Failed","activityTime":"Thu Aug 13 18:48:39 UTC 2015","activityType":"GCCancellation","cardNumber":null,"cardValue":null,"failureCode":"GeneralError","gcId":"A1CRLBZ838H2PT","isRealOp":"false","partnerId":"Awssb","requestId":"Awssb0829141556PM"},{"activityStatus":"Failed","activityTime":"Thu Aug 13 18:49:06 UTC 2015","activityType":"GCCancellation","cardNumber":null,"cardValue":null,"failureCode":"GeneralError","gcId":"A1CRLBZ838H2PT","isRealOp":"false","partnerId":"Awssb","requestId":"Awssb0829141556PM"},{"activityStatus":"Failed","activityTime":"Thu Aug 13 18:49:31 UTC 2015","activityType":"GCCancellation","cardNumber":null,"cardValue":null,"failureCode":"GeneralError","gcId":"A1CRLBZ838H2PT","isRealOp":"false","partnerId":"Awssb","requestId":"Awssb0829141556PM"},{"activityStatus":"Failed","activityTime":"Thu Aug 13 18:50:10 UTC 2015","activityType":"GCCancellation","cardNumber":null,"cardValue":null,"failureCode":"GeneralError","gcId":"A1CRLBZ838H2PT","isRealOp":"false","partnerId":"Awssb","requestId":"Awssb0829141556PM"},{"activityStatus":"Success","activityTime":"Thu Aug 13 18:50:37 UTC 2015","activityType":"GCCreation","cardNumber":null,"cardValue":{"amount":1.23,"currencyCode":"USD"},"failureCode":null,"gcId":"AHHB14UYBGXXM","isRealOp":"true","partnerId":"Awssb","requestId":"Awssb0813151150AM"},{"activityStatus":"Failed","activityTime":"Thu Aug 13 18:50:38 UTC 2015","activityType":"GCCancellation","cardNumber":null,"cardValue":null,"failureCode":"GeneralError","gcId":"A1CRLBZ838H2PT","isRealOp":"false","partnerId":"Awssb","requestId":"Awssb0829141556PM"},{"activityStatus":"Success","activityTime":"Thu Aug 13 18:50:53 UTC 2015","activityType":"GCCancellation","cardNumber":null,"cardValue":null,"failureCode":null,"gcId":"AHHB14UYBGXXM","isRealOp":"true","partnerId":"Awssb","requestId":"Awssb0813151150AM"}],"pageIndex":0,"requestId":"AwssbGetGCAPTest001","status":"SUCCESS","totalNumberOfTransactionsInRequestedTimeFrame":10} XML <GetGiftCardActivityPageResponse> <totalNumberOfTransactionsInRequestedTimeFrame>10</totalNumberOfTransactionsInRequestedTimeFrame> <pageIndex>0</pageIndex> <requestId>AwssbGetGCAPTest001</requestId> <cardActivityList> <member> <requestId>Awssb0829140906AM</requestId> <gcId>A3Q7TCFUJ5LS5Q</gcId> <activityStatus>Success</activityStatus> <activityTime>Thu Aug 13 18:46:21 UTC 2015</activityTime> <isRealOp>false</isRealOp> <partnerId>Awssb</partnerId> <activityType>GCCreation</activityType> <cardValue> <currencyCode>USD</currencyCode> <amount>10.0</amount>

Page 23

</cardValue> </member> <member> <requestId>Awssb0829141507PM</requestId> <gcId>A1AR2XOII0L9DE</gcId> <activityStatus>Success</activityStatus> <activityTime>Thu Aug 13 18:46:41 UTC 2015</activityTime> <isRealOp>false</isRealOp> <partnerId>Awssb</partnerId> <activityType>GCCreation</activityType> <cardValue> <currencyCode>USD</currencyCode> <amount>10.0</amount> </cardValue> </member> <member> <requestId>Awssb0829141556PM</requestId> <gcId>A1CRLBZ838H2PT</gcId> <activityStatus>Success</activityStatus> <activityTime>Thu Aug 13 18:47:05 UTC 2015</activityTime> <isRealOp>false</isRealOp> <partnerId>Awssb</partnerId> <activityType>GCCreation</activityType> <cardValue> <currencyCode>USD</currencyCode> <amount>10.0</amount> </cardValue> </member> <member> <failureCode>GeneralError</failureCode> <requestId>Awssb0829141556PM</requestId> <gcId>A1CRLBZ838H2PT</gcId> <activityStatus>Failed</activityStatus> <activityTime>Thu Aug 13 18:48:39 UTC 2015</activityTime> <isRealOp>false</isRealOp> <partnerId>Awssb</partnerId> <activityType>GCCancellation</activityType> </member> <member> <failureCode>GeneralError</failureCode> <requestId>Awssb0829141556PM</requestId> <gcId>A1CRLBZ838H2PT</gcId> <activityStatus>Failed</activityStatus> <activityTime>Thu Aug 13 18:49:06 UTC 2015</activityTime> <isRealOp>false</isRealOp> <partnerId>Awssb</partnerId> <activityType>GCCancellation</activityType> </member> <member> <failureCode>GeneralError</failureCode> <requestId>Awssb0829141556PM</requestId> <gcId>A1CRLBZ838H2PT</gcId> <activityStatus>Failed</activityStatus> <activityTime>Thu Aug 13 18:49:31 UTC 2015</activityTime> <isRealOp>false</isRealOp> <partnerId>Awssb</partnerId> <activityType>GCCancellation</activityType> </member>

Page 24

<member> <failureCode>GeneralError</failureCode> <requestId>Awssb0829141556PM</requestId> <gcId>A1CRLBZ838H2PT</gcId> <activityStatus>Failed</activityStatus> <activityTime>Thu Aug 13 18:50:10 UTC 2015</activityTime> <isRealOp>false</isRealOp> <partnerId>Awssb</partnerId> <activityType>GCCancellation</activityType> </member> <member> <requestId>Awssb0813151150AM</requestId> <gcId>AHHB14UYBGXXM</gcId> <activityStatus>Success</activityStatus> <activityTime>Thu Aug 13 18:50:37 UTC 2015</activityTime> <isRealOp>true</isRealOp> <partnerId>Awssb</partnerId> <activityType>GCCreation</activityType> <cardValue> <currencyCode>USD</currencyCode> <amount>1.23</amount> </cardValue> </member> <member> <failureCode>GeneralError</failureCode> <requestId>Awssb0829141556PM</requestId> <gcId>A1CRLBZ838H2PT</gcId> <activityStatus>Failed</activityStatus> <activityTime>Thu Aug 13 18:50:38 UTC 2015</activityTime> <isRealOp>false</isRealOp> <partnerId>Awssb</partnerId> <activityType>GCCancellation</activityType> </member> <member> <requestId>Awssb0813151150AM</requestId> <gcId>AHHB14UYBGXXM</gcId> <activityStatus>Success</activityStatus> <activityTime>Thu Aug 13 18:50:53 UTC 2015</activityTime> <isRealOp>true</isRealOp> <partnerId>Awssb</partnerId> <activityType>GCCancellation</activityType> </member> </cardActivityList> <status>SUCCESS</status> </GetGiftCardActivityPageResponse>

Required Parameters

Please note that the currency value (USD, GBP, EUR, JPY, CNY, AUD) might vary based on your locale

1 HTTP Request Method=POST

Page 25

2 Canonical URI=/GetGiftCardActivityPage

3 Canonical Query String=’’ (empty string)

4 Canonical Headers=

accept:application/json

content-type:application/json

host: agcod-v2-gamma.amazon.com x-amz-date: 20150813T190248Z x-amz-

target:com.amazonaws.agcod.AGCODService.GetGiftCardActivityPage

or

accept:application/x-www-form-urlencoded; charset=UTF-8

content-type:application/x-www-form-urlencoded; charset=UTF-8

host: agcod-v2-gamma.amazon.com x-amz-date: 20150813T190248Z x-amz-

target:com.amazonaws.agcod.AGCODService.GetGiftCardActivityPage

5 SignedHeaders=content-type;host;x-amz-date;x-amz-target

6 Algorithm= AWS4-HMAC-SHA256

7 Request Date= 20150813T190248Z

8 CredentialScope=20150813/us-east-1/AGCODService/aws4_request

9 Service Name=AGCODService

10 Host= agcod-v2-gamma.amazon.com (use applicable endpoint)

11 Region Name=us-east-1 (use applicable endpoint)

12 Partner Id=Awssb (use your own Partner ID)

13 KeyId=1

14 pageIndex=0 (starting page number)

15 pageSize=200 (# of transactions displayed per page)

16 utcStartDate= 2015-08-12T00:00:00Z

17 utcEndDate= 2015-08-14T00:00:00Z

18 showNoOps=true

Page 26

4. Mocking Test Examples

SUCCESS Mocking test with requestId "F0000"

PAYLOAD:

<CreateGiftCardRequest><creationRequestId>F0000</creationRequestId><partnerId

>Awssb</partnerId><value><currencyCode>phonybucks</currencyCode><amount>-

3.14159</amount></value></CreateGiftCardRequest>

HASHED PAYLOAD:

7ea6c536e7586fb525f49aaeb4fd3c6971a696f125da6447d12d29a1973fb004

CANONICAL REQUEST:

POST

/CreateGiftCard

accept:charset=UTF-8

content-type:charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20140205T170041Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

accept;content-type;host;x-amz-date;x-amz-target

7ea6c536e7586fb525f49aaeb4fd3c6971a696f125da6447d12d29a1973fb004

HASHED CANONICAL REQUEST:

0d1c6d7d24f929697e7eae8edae3405d8185c93ccbef2ca5bd098eaa10be42fb

STRING TO SIGN:

AWS4-HMAC-SHA256

20140205T170041Z

20140205/us-east-1/AGCODService/aws4_request

0d1c6d7d24f929697e7eae8edae3405d8185c93ccbef2ca5bd098eaa10be42fb

DERIVED SIGNING KEY:

07ef165a0531f64ac7ba835805728d63c296be4d0012a226454795f74644aa02

SIGNATURE:

bf772d6fd53ae30f0439e6362e7a9b9dd570893d5db66950d6bbcb72a0a08da3

ENDPOINT:

agcod-v2-gamma.amazon.com

SIGNED REQUEST

POST /CreateGiftCard HTTP/1.1

accept:charset=UTF-8

content-type:charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20140205T170041Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

Authorization:AWS4-HMAC-SHA256 Credential=AKIAJBYCL67O6NJUNYBQ/20140205/us-

east-1/AGCODService/aws4_request, SignedHeaders=accept;content-type;host;x-

amz-date;x-amz-target,

Signature=bf772d6fd53ae30f0439e6362e7a9b9dd570893d5db66950d6bbcb72a0a08da3

Page 27

<CreateGiftCardRequest><creationRequestId>F0000</creationRequestId><partnerId

>Awssb</partnerId><value><currencyCode>phonybucks</currencyCode><amount>-

3.14159</amount></value></CreateGiftCardRequest>

<CreateGiftCardResponse> <creationRequestId>F0000</creationRequestId> <cardInfo> <value> <amount>-3.14159</amount> <currencyCode>phonybucks</currencyCode> </value> <cardStatus>Fulfilled</cardStatus> </cardInfo> <status>SUCCESS</status> <gcId>ABC123ZYX987</gcId> <gcClaimCode>ZYXW-VUTS-RQPO</gcClaimCode> </CreateGiftCardResponse>

FAILURE Mocking test with requestId “F2005”

PAYLOAD:

<CreateGiftCardRequest><creationRequestId>F2005</creationRequestId><partnerId

>Awssb</partnerId><value><currencyCode>USD</currencyCode><amount>-

3.14159</amount></value></CreateGiftCardRequest>

HASHED PAYLOAD:

a425f0a78f494a56033e3ddf07c592bd97060eed8d337d30ed3965ddce235699

CANONICAL REQUEST:

POST

/CreateGiftCard

accept:charset=UTF-8

content-type:charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20140205T170938Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

accept;content-type;host;x-amz-date;x-amz-target

a425f0a78f494a56033e3ddf07c592bd97060eed8d337d30ed3965ddce235699

HASHED CANONICAL REQUEST:

3c313ac758bd441cfae841705c1449ef3c47267c355a547665d6c3afe05e4cd3

STRING TO SIGN:

AWS4-HMAC-SHA256

20140205T170938Z

20140205/us-east-1/AGCODService/aws4_request

3c313ac758bd441cfae841705c1449ef3c47267c355a547665d6c3afe05e4cd3

DERIVED SIGNING KEY:

07ef165a0531f64ac7ba835805728d63c296be4d0012a226454795f74644aa02

Page 28

SIGNATURE:

f00fea4fa7812f7910c90e6ffb9e973c45b80ce9f1e05228a1fdde1d87cde075

ENDPOINT:

agcod-v2-gamma.amazon.com

SIGNED REQUEST

POST /CreateGiftCard HTTP/1.1

accept:charset=UTF-8

content-type:charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20140205T170938Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

Authorization:AWS4-HMAC-SHA256 Credential=AKIAJBYCL67O6NJUNYBQ/20140205/us-

east-1/AGCODService/aws4_request, SignedHeaders=accept;content-type;host;x-

amz-date;x-amz-target,

Signature=f00fea4fa7812f7910c90e6ffb9e973c45b80ce9f1e05228a1fdde1d87cde075

<CreateGiftCardRequest><creationRequestId>F2005</creationRequestId><partnerId

>Awssb</partnerId><value><currencyCode>USD</currencyCode><amount>-

3.14159</amount></value></CreateGiftCardRequest>

RESPONSE: <AGCODValidationException> <Message>Currency Code can't be null or empty</Message> <errorType>InvalidCurrencyCodeInput</errorType> <errorCode>F200</errorCode> <agcodResponse> <status>FAILURE</status> </agcodResponse> </AGCODValidationException>

5. Known-answer V4 Signature Example

To assist you in the development, we have included a test example with fictitious Access Key/ Secret

Keys to generate a known-answer test for different stages of the signing below. Details on how to

execute on each stage of the signing can be found here (visual).

Parameters used

Partner ID: Test creationRequestId: Test001 AGCODAccess Key: fake-access-key AGCOD Secret Key: fake-secret-key Timestamp: 20140205T171524Z kSecret: 4157533466616b652d7365637265742d6b6579 kDate: 41b8dd5e0d1716ba90401d46b58b12d500accdd2ea9c2b22a2d275946c9d978e kRegion: 7b47360ce7afbe1b839e0b0e55834df99979a5414bc7f846b17c9374d230d45d kService: 68136b0a64b2d01c8934370288b46500243645e468f521503e0d1fa73526d409

Page 29

kSigning: 27cb9f5b991c2933f5faae716e99bd50c66a45811b1424128269312bdd570dff

PAYLOAD:

<CreateGiftCardRequest><creationRequestId>Test001</creationRequestId><partner

Id>Test</partnerId><value><currencyCode>USD</currencyCode><amount>10</amount>

</value></CreateGiftCardRequest>

HASHED PAYLOAD:

50bf24a091a7463bb4a2661f93a7299c94774bc81f9fddf02af2925922b869dc

CANONICAL REQUEST:

POST

/CreateGiftCard

accept:charset=UTF-8

content-type:charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20140205T171524Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

accept;content-type;host;x-amz-date;x-amz-target

50bf24a091a7463bb4a2661f93a7299c94774bc81f9fddf02af2925922b869dc

HASHED CANONICAL REQUEST:

7d9f2765e4f23e85d3dce4ae264dac4f784c152f3746aff45ac7f3afd7fad649

STRING TO SIGN:

AWS4-HMAC-SHA256

20140205T171524Z

20140205/us-east-1/AGCODService/aws4_request

7d9f2765e4f23e85d3dce4ae264dac4f784c152f3746aff45ac7f3afd7fad649

DERIVED SIGNING KEY:

27cb9f5b991c2933f5faae716e99bd50c66a45811b1424128269312bdd570dff

SIGNATURE:

e32110cf663ed86460621dff12bb1139afe29d015584d208df09f149fa1b69d1

ENDPOINT:

agcod-v2-gamma.amazon.com

SIGNED REQUEST

POST /CreateGiftCard HTTP/1.1

accept:charset=UTF-8

content-type:charset=UTF-8

host:agcod-v2-gamma.amazon.com

x-amz-date:20140205T171524Z

x-amz-target:com.amazonaws.agcod.AGCODService.CreateGiftCard

Authorization:AWS4-HMAC-SHA256 Credential=fake-aws-key/20140205/us-east-

1/AGCODService/aws4_request, SignedHeaders=accept;content-type;host;x-amz-

date;x-amz-target,

Signature=e32110cf663ed86460621dff12bb1139afe29d015584d208df09f149fa1b69d1

<CreateGiftCardRequest><creationRequestId>Test001</creationRequestId><partner

Id>Test</partnerId><value><currencyCode>USD</currencyCode><amount>10</amount>

</value></CreateGiftCardRequest>

Page 30

Appendix-5: Card Status The gift code API will return the current cardStatus of gift code within the CREATE gift code response.

Fulfilled – gift code has been successfully created

<CreateGiftCardResponse> <gcClaimCode>KR2G-W4CQNJ-WQS8</gcClaimCode> <cardInfo> <value> <currencyCode>USD</currencyCode> <amount>1.0</amount> </value> <cardStatus>Fulfilled</cardStatus> </cardInfo> <gcId>A2BN7W2SGEZFFE</gcId> <creationRequestId>Awssb-ABR-09</creationRequestId> <status>SUCCESS</status> </CreateGiftCardResponse>

RefundedToPurchaser – gift code has been successfully cancelled and refunded

<CreateGiftCardResponse> <gcClaimCode>KR2G-W4CQNJ-WQS8</gcClaimCode> <cardInfo> <value> <currencyCode>USD</currencyCode> <amount>1.0</amount> </value> <cardStatus>RefundedToPurchaser</cardStatus> </cardInfo> <gcId>A2BN7W2SGEZFFE</gcId> <creationRequestId>Awssb-ABR-09</creationRequestId> <status>SUCCESS</status> </CreateGiftCardResponse> Expired – gift code was not claimed prior to the expiration date. Note, gift codes do not expire in the Unites States or Canada. <CreateGiftCardResponse> <gcClaimCode>G22G-WACQNJ-27S8</gcClaimCode> <cardInfo> <value> <currencyCode>JPY</currencyCode> <amount>1.0</amount> </value> <cardStatus>Expired</cardStatus>

Page 31

</cardInfo> <gcId>A2BWWZ1SGEZF2F</gcId> <creationRequestId>Awssb-ABR-10</creationRequestId> <status>SUCCESS</status> </CreateGiftCardResponse>

Appendix-7: Sandbox and Production Endpoints

Sandbox

For US/CA/MX (NA) - https://agcod-v2-gamma.amazon.com (use region us-east-1) For IT/ES/DE/FR/UK (EU) - https://agcod-v2-eu-gamma.amazon.com (use region eu-west-1)

For JP/AU (FE) - https://agcod-v2-fe-gamma.amazon.com (use region us-west-2)

Production For US/CA/MX (NA) - https://agcod-v2.amazon.com (use region us-east-1) For IT/ES/DE/FR/UK (EU) - https://agcod-v2-eu.amazon.com (use region eu-west-1)

For JP/AU (FE) - https://agcod-v2-fe.amazon.com (use region us-west-2)

Appendix-8: Throttle Rates

AGCOD will throttle/decline incoming requests to prevent misuse of the system. The request rate

cannot exceed more than 10 per second, per partner, inclusive of all transaction types with the

exception of the GetGiftCardActivityPage, which has a maximum request rate of one per minute.

API Throttle Rate (# of requests)

GetGiftCardActivityPage 1 per minute

CreateGiftCard (only applicable if

you are using Web Creation APIs)

10 per second

CancelGiftCard (only applicable if

you are using Web Creation APIs)

10 per second

ActivateGiftCard (only applicable

if you are using Web Activation

APIs)

10 per second

DeactivateGiftCard (only

applicable if you are using Web

Activation APIs)

10 per second

ActivationStatusCheck (only

applicable if you are using Web

Activation APIs)

10 per second

Page 32

Appendix-9: Error Handling

Every response sent from the AGCOD Gateway has an associated Status element that describes the

execution status for the particular operation; there are three statusCode values:

SUCCESS/FAILURE/RESEND.

(i) statusCode: SUCCESS A statusCode of SUCCESS is returned if the operation is successful.

(ii) statusCode: FAILURE A statusCode of FAILURE is returned if the request cannot be honored by AGCOD Gateway – this status

response may include invalid request data or some business logic error that needs to be reviewed by the

partner. The errorCode field will be populated in such cases providing additional details pertaining to the

error.

(iii) statusCode: RESEND A statusCode of RESEND is returned if there is a temporary/recoverable system failure that can be

resolved by the partner retrying the request. The errorCode field will be populated in such cases

providing additional details pertaining to the error.

The RESEND error should not be interpreted as a failure. The operation status simply could not be

determined at the time of submission. In these cases, the partner is expected to retry the request using

the same input data as the original request until a definitive response status (SUCCESS or FAILURE) is

obtained.

The partner should throttle their retry requests to avoid flooding the AGCOD Gateway. We recommend

a simple approach like an exponential back-off scheme.

(iv) Error Codes We are using a convention of F2XX codes to denote errors when the cause is on the partner’s side and

F1XX if the cause is on Amazon’s side.

We have provided mock error request IDs to simulate certain error responses with the Create/Cancel

calls. When simulating an error response, the mock error request ID will need to be passed in to the

creationRequestId field, similar to a normal request ID. The values passed in for the rest of the fields will

simply be echoed in the response. To simulate a successful response, the value of F1000 can be passed

in for the mock error request ID. See the Mocking test examples section for more details and refer to

Appendix-9 for the Error Codes.

Page 33

Appendix-10: Error Codes Error Category Explanation

F100 [System Errors] SimpleAmountIsNull ErrorCode – F100 ErrorType – GeneralError Message – General Error Mock Error Request ID – F1000

AmountIsNull ErrorCode – F100 ErrorType – GeneralError Message – General Error Mock Error Request ID – F1000

CurrencyCodeIsNull ErrorCode – F100 ErrorType – GeneralError Message – General Error Mock Error Request ID – F1000

GcLocked ErrorCode – F100 ErrorType – GeneralError Message – General Error Mock Error Request ID – F1000

EmptyCardInfoList ErrorCode – F100 ErrorType – GeneralError Message – General Error Mock Error Request ID – F1000

RequestError ErrorCode – F100 ErrorType – GeneralError Message – General Error Mock Error Request ID – F1000

F200 [Partner Input Errors] InvalidRequestInput ErrorCode – F200 ErrorType – InvalidRequestInput Message – Request body is null Mock Error Request ID – F2000

InvalidCardNumberInput ErrorCode – F200 ErrorType – InvalidCardNumberInput Message – Card number can't be null or empty Mock Error Request ID – F2001

InvalidPartnerIdInput ErrorCode – F200 ErrorType – InvalidPartnerIdInput Message – Partner Id can't be null or empty

Page 34

Error Category Explanation

Mock Error Request ID – F2002

InvalidAmountInput

ErrorCode – F200 ErrorType – InvalidAmountInput Message – Amount can't be null Mock Error Request ID – F2003

InvalidAmountValue ErrorCode – F200 ErrorType – InvalidAmountValue Message – Amount must be larger than 0 Mock Error Request ID – F2004

InvalidCurrencyCodeInput ErrorCode – F200 ErrorType – InvalidCurrencyCodeInput Message – Currency Code can't be null or empty Mock Error Request ID – F2005

InvalidRequestIdInput ErrorCode – F200 ErrorType – InvalidRequestIdInput Message – Request Id can’t be null or empty Mock Error Request ID – F2006

CardNumberNotFound ErrorCode – F200 ErrorType – CardNumberNotFound Message – Card Number Not Found Mock Error Request ID – F2007

RequestedDenominationMismatch ErrorCode – F200 ErrorType – PreDenominationMismatch Message – Pre Denomination Mismatch – The Card was created with a different denomination Mock Error Request ID – F2008

CardActivatedWithDifferentDenomination ErrorCode – F200 ErrorType – CardAlreadyActivatedWithDifferentDenomination Message – The card was already activated with a different denomination Mock Error Request ID – F2009

CardActivatedWithDifferentRequestId ErrorCode – F200 ErrorType – CardAlreadyActivatedWithDifferentRequestId Message – The card was already activated with a different request id Mock Error Request ID – F2010

Page 35

Error Category Explanation

ActivationNotAllowed ErrorCode – F200 ErrorType – InvalidCardStatusForActivation Message – Current card status is not valid for activation Mock Error Request ID – F2011

DeactivationNotAllowed ErrorCode – F200 ErrorType – InvalidCardStatusForDeactivation Message – Current card status is not valid for deactivation Mock Error Request ID – F2012

ActivationRequestIdAlreadyBeenUsed ErrorCode – F200 ErrorType – ActivationRequestIdAlreadyBeenUsed Message – Activation RequestId Already Been Used Mock Error Request ID – F2013

NegativeOrZeroAmount ErrorCode – F200 ErrorType – NegativeOrZeroAmount Message – Negative Or Zero Amount Mock Error Request ID – F2014

MaxAmountExceeded ErrorCode – F200 ErrorType – MaxAmountExceeded Message – Max Amount Exceeded Mock Error Request ID – F2015

CurrencyCodeMismatch ErrorCode – F200 ErrorType – CurrencyCodeMismatch Message – Currency Code Mismatch Mock Error Request ID – F2016

FractionalAmountNotAllowed ErrorCode – F200 ErrorType – FractionalAmountNotAllowed Message – Fractional Amount Not Allowed Mock Error Request ID – F2017

NonExistingActivationRequestId ErrorCode – F200 ErrorType – NonExistingActivationRequestId Message – No matching activation request ID Mock Error Request ID – F2018

WrongActivationRequestId ErrorCode – F200 ErrorType – WrongActivationRequestId

Page 36

Error Category Explanation

Message – Wrong Activation RequestId Mock Error Request ID – F2019

GcRTPNotAllowed ErrorCode – F200 ErrorType – GeneralError Message – General Error Mock Error Request ID – F2020

RequestIdTooLong ErrorCode – F200 ErrorType – RequestIdTooLong Message – Request Id Too Long, Max allowed length is 19 Mock Error Request ID – F2021

RequestIdMustStartWithPartnerName ErrorCode – F200 ErrorType – RequestIdMustStartWithPartnerName Message – Request Id Must Start With Partner Name Mock Error Request ID – F2022

CardNumberTooShort ErrorCode – F200 ErrorType – InvalidCardNumber Message – Invalid Card Number Mock Error Request ID – F2023

CardNumberCheckSumError ErrorCode – F200 ErrorType – InvalidCardNumber Message – Invalid Card Number Mock Error Request ID – F2023

InvalidGCIdInput ErrorCode -- F200 ErrorType -- InvalidGCIdInput Message -- GC Id can't be null or empty Mock Error Request ID – F2024

InvalidRequest ErrorCode -- F200 ErrorType -- InvalidRequest Message -- GC Id can't be null or empty Mock Error Request ID – F2025

MaxPageSizeExceeded ErrorCode -- F200 ErrorType -- MaxPageSizeExceeded Message -- Max Page Size Exceeded Mock Error Request ID – F2026

InvalidPageSize ErrorCode -- F200

Page 37

Error Category Explanation

ErrorType -- InvalidPageSize Message -- Invalid Page Size Mock Error Request ID – F2027

InvalidPageIndex ErrorCode -- F200 ErrorType -- InvalidPageIndex Message -- Invalid Page Index Mock Error Request ID – F2028

InvalidStartDate ErrorCode -- F200 ErrorType -- InvalidStartDate Message -- Invalid Start Date Mock Error Request ID – F2029

InvalidEndDate ErrorCode -- F200 ErrorType -- InvalidEndDate Message -- Invalid End Date Mock Error Request ID – F2030

StartDateAfterEndDate ErrorCode -- F200 ErrorType -- StartDateAfterEndDate Message -- Start Date After End Date Mock Error Request ID – F2031

InvalidDateFormat ErrorCode -- F200 ErrorType -- InvalidDateFormat Message -- Invalid Date Format Mock Error Request ID – F2032

ExternalReferenceTooLong ErrorCode -- F200 ErrorType -- ExternalReferenceTooLong Message -- External Reference is too long Mock Error Request ID – F2042

CancelRequestArrivedAfterTimeLimit ErrorCode -- F200 ErrorType -- CancelRequestArrivedAfterTimeLimit Message -- Cancellation cannot be processed as too much time has elapsed since creation Mock Error Request ID – F2047

ProgramIdNotPresent ErrorCode – F200 ErrorType – ProgramIdNotPresent Message – Program Id is not present Mock Error Request ID – F2048

F300 [Partner Account/Access/Onboarding Errors] InvalidPartnerId ErrorCode – F300

Page 38

Error Category Explanation

ErrorType – InvalidPartnerId Message – Invalid Partner Id Mock Error Request ID – F3000

InvalidAccessKey ErrorCode – F300 ErrorType – InvalidAccessKey Message – Invalid Access Key Mock Error Request ID – F3001

AccessDenied ErrorCode – F300 ErrorType – AccessDenied Message – Access Denied Mock Error Request ID – F3002

InsufficientFunds ErrorCode – F300 ErrorType – InsufficientFunds Message – Insufficient Funds Mock Error Request ID – F3003

GeneralError ErrorCode – F300 ErrorType – GeneralError Message – General Error Mock Error Request ID – F3005

AccountHasProblems ErrorCode – F300 ErrorType – GeneralError Message – General Error Mock Error Request ID – F3005

OrderNotFound ErrorCode -- F300 ErrorType -- GeneralError Message – General Error Mock Error Request ID – F3005

WrongGcOrderSource ErrorCode -- F300 ErrorType -- GeneralError Message – General Error Mock Error Request ID – F3005

WrongGcOrderType ErrorCode -- F300 ErrorType -- GeneralError Message – General Error Mock Error Request ID – F3005

GcOrderBelongToOtherCustomer ErrorCode -- F300 ErrorType -- GeneralError

Page 39

Error Category Explanation

Message – General Error Mock Error Request ID – F3005

OperationNotPermitted ErrorCode – F300 ErrorType – OperationNotPermitted Message – Operation Not Permitted Mock Error Request ID – F3006

BadInput ErrorCode – F300 ErrorType – BadInput Message – Bad Input Data Mock Error Request ID – F3007

APIGetGiftCardActivityPageIsDisabled ErrorCode – F300 ErrorType – GeneralError Message – GeneralError Mock Error Request ID – F3008

ActiveContractNotFound ErrorCode – F300 ErrorType – ActiveContractNotFound Message – Active Contract Not Found Mock Error Request ID – F3009

InvalidProgramId ErrorCode – F300 ErrorType – InvalidProgramId Message – Program Id does not exist in Amazon system

Mock Error Request ID – F3010

ProgramIsNotApproved

ErrorCode - F300 ErrorType – InvalidProgramId Message – Program is not approved

Mock Error Request ID – F3011

F400 [RESEND Errors] SystemTemporarilyUnavailable ErrorCode – F400 ErrorType – SystemTemporarilyUnavailable Message – System Temporarily Unavailable Note: Response Status would be “RESEND” and not Failure. Mock Error Request ID – F4000

F500 – [Unknown Error] UnknownError ErrorCode – F500 ErrorType – GeneralError Message – GeneralError Mock Error Request ID – F5000

Page 40

Document Revision History

Date Version Changes

2-23-2015 1.01 Create document

4-21-2015 1.02 Removed references to FPS Sandbox

6-12-2015 1.03 Minor editing

11-10-2015 1.04 Update sample CREATE responses (cardStatus)

12-14-2015 1.05 Removed IssuanceCapExceeded response (replaced by InsufficientFunds)

12-1-2017 1.06 Added two F200 mock error codes

3-7-2019 1.07 Updated access keys

7-19-2019 1.08 Added F200 and F300 Error codes