Vielen Dank für deinen Besuch. Diese Seite ist nur in Englisch verfügbar.

Amazon Pay Scratchpad User Guide

Amazon Pay Scratchpad is an application that enables you to easily submit requests using any of the Amazon Pay APIs. You can indicate any required and optional parameters of the request from the Amazon Pay Scratchpad user interface. If you are configuring the Amazon Pay button, you can use the Button Code generator to generate the necessary code to render the button. Amazon Pay Scratchpad automatically creates a valid request signature, necessary headers, and then submits your request to the Amazon Pay Sandbox environment. Amazon Pay Scratchpad then displays the response from Amazon Pay Web Service.

Amazon Pay Scratchpad can be a helpful tool for software developers who are developing solutions using Amazon Pay APIs. Because Amazon Pay Scratchpad automatically generates and displays many of the inputs that are required in a request to Amazon Pay APIs, you can see how these inputs look when they are correctly formed. Examining the Amazon Pay API responses that Amazon Pay Scratchpad displays for each of your requests can help you develop a successful integration to Amazon Pay.

Who should use Amazon Pay Scratchpad?

To use Amazon Pay Scratchpad, you should have a basic understanding of how to submit a request to Amazon Pay APIs. For more information, see Checkout with Amazon Pay.


Using Amazon Pay Scratchpad

Once you’ve registered for an Amazon Pay account and acquired your API keys, you can begin interacting with the Amazon Pay API’s using Amazon Pay Scratchpad. Use the tool to submit a request to the Amazon Pay API and get a response. The Scratchpad tool returns sample code to help you understand how the Amazon Pay API works and helps you integrate with ease. Be sure to use the right tool for your specific region: US, EU, JP.

Getting Started

1. Authentication

In the Authentication area of Amazon Pay Scratchpad enter your Region, Public Key Id, Private Key, and optionally Authorization Token. Clicking Authentication in the left navigation opens the Authentication configuration and displays the following input fields. See Get your Public Key ID for more info.

Region - The region in which the merchant account you will be using is registered.

Public Key Id - RSA Public Key ID (this is not the Merchant or Seller ID)

Private Key - Path to RSA Private Key

Auth Token - Authorization token used by third party developers to make delegated API calls on behalf of a merchant. This value is passed in the header key X-Amz-Pay-AuthToken

2. Select an API Operation

Expand the API section in the left navigation to view the list of available API operations and click an operation to configure the request parameters. Required and optional API parameters will vary across Amazon Pay API’s. An API parameter that is not required will include “(optional)” beside the parameter name. There are instances where adding one optional parameter will then require setting additional optional parameters on the request, so be sure to refer to the Amazon Pay API documentation for details.

3. Submit the API Request

On a successful request, the Amazon Pay Scratchpad displays the following information as response:

API Request - All API requests to Amazon Pay must be secured by signing them with your private key. The signature is used to verify the identity of the requestor and protect the data during transit. The Amazon Pay Scratchpad will generate the signature on your behalf and share the steps in this section.

Request Signature section displays the following:

  • Request Headers - The canonical headers used in the request, followed by a newline character. The canonical headers is a list of all the HTTP headers that you are including with the signed request. See API introduction for mandatory headers.
  • Canonical Request - The contents of your request (host, action, headers, etc.) arranged into a standard (canonical) format.
  • String to sign - A string generated by concatenating the hashing algorithm designation (AMZN-PAY-RSASSA-PSS) and the digest (hash) of the canonical request.

API Response - The API Response section displays the following:

  • Status Code - The HTTP Status Code element of the Amazon Pay API response. See Error Codes for details on generic error codes that Amazon Pay APIs can return.
  • Request ID - The unique identifier of the request returned in the response header from the Amazon Pay API.
  • Response Body - The JSON formatted response body returned from the Amazon Pay API.

Using Amazon Pay Scratchpad to Generate Button Code

The Amazon Pay Scratchpad includes a Button Code section for configuring and rendering the Amazon Pay button. After completing the Authentication section, click Button Code from the left navigation to display the Amazon Pay Button rendering workflow. Select the appropriate Button Type, and click Next to configure the button. Configure the options appropriate for the button type selected, then click Next to render the button and view generated code.

Button Code

The Button Code section includes the HTML and JavaScript necessary to render the configured button.

Sign the payload

Sign the payload section includes code necessary to generate the signature for the button’s payloadJSON using helper functions provided in the Amazon Pay SDK's. The SDKs are available in PHP, .NET, Java and Node.js languages. For additional details, see Sign the payload or build the signature manually by following steps 2 and 3 of the signing requests guide.