Amazon In-App Purchasing Python API Docs | dltHub

Build a Amazon In-App Purchasing-to-database pipeline in Python using dlt with AI Workbench support for Claude Code, Cursor, and Codex.

Last updated:

Amazon In-App Purchasing (IAP) is a set of APIs and client libraries that let apps offer, process, and verify in-app purchases (consumables, entitlements, and subscriptions) for Amazon Appstore users. The REST API base URL is For client-side Web App IAP library calls the Amazon Web App resources URL: https://resources.amazonwebapps.com/v1/latest/Amazon-Web-App-API.min.js (client library). For server-side receipt verification (RVS) use RVS endpoints: https://appstore-sdk.amazon.com/version/1.0/verifyReceiptId/... (production) and https://appstore-sdk.amazon.com/sandbox/version/1.0/verifyReceiptId/... (sandbox). and Server-side RVS requests require a developer shared secret in the URL path; client Web IAP uses the Amazon client to handle authentication..

dlt is an open-source Python library that handles authentication, pagination, and schema evolution automatically. dlthub provides AI context files that enable code assistants to generate production-ready pipelines. Install with uv pip install "dlt[workspace]" and start loading Amazon In-App Purchasing data in under 10 minutes.


What data can I load from Amazon In-App Purchasing?

Here are some of the endpoints you can load from Amazon In-App Purchasing:

ResourceEndpointMethodData selectorDescription
- user_data(client) AmazonIapV2.getUserData() (client JS)GET (client library method)N/A (response object delivered to getUserDataResponse handler; user data fields in object)Retrieves app-specific userId and marketplace for the logged-in Amazon user.
- product_data(client) AmazonIapV2.getProductData(skus) (client JS)GET (client library method)data.productDataMapReturns product metadata keyed by SKU (productDataMap).
- purchase_updates(client) AmazonIapV2.getPurchaseUpdates(reset) (client JS)GET (client library method)data.receiptsReturns receipts and unavailable SKUs; receipts are delivered in data.receipts (hash table keyed by SKU).
- purchase(client) AmazonIapV2.purchase(sku) (client library method)POST (client library method)N/A (purchaseResponse object; not a list)Initiates an in-app purchase flow; response delivered to purchaseResponse handler.
- notify_fulfillment(client) AmazonIapV2.notifyFulfillment(receiptId, fulfillmentResult) (client library method)POST (client library method)N/AAcknowledges fulfillment status for a receipt (FULFILLED or UNAVAILABLE).
- rvs_verify_receiptversion/1.0/verifyReceiptId/developer/{shared-secret}/user/{user-id}/receiptId/{receipt-id}GETtop-level JSON object (not an array)Server-side Receipt Verification Service (RVS) verifies a single receipt and returns a JSON object with fields such as productId, productType, receiptId, purchaseDate, cancelDate, renewalDate, testTransaction, promotions, etc.

How do I authenticate with the Amazon In-App Purchasing API?

Web App IAP is a client-side JavaScript library (AmazonIapV2) that uses the Amazon client to authenticate users; you call library methods (getUserData, getProductData, getPurchaseUpdates) and register response handlers. RVS server-side verification requests require the developer shared secret (shared key) passed in the URL path segment /developer/{shared-secret}/ and the user-id and receiptId as path segments. No additional Authorization header is described for RVS; responses are returned as JSON.

1. Get your credentials

  1. Sign in to your Amazon Developer Console (https://developer.amazon.com). 2) Open your app's dashboard and locate the Shared Key / Shared Secret page (Shared Key page: https://developer.amazon.com/sdk/shared-key.html). 3) Copy the Shared Secret (use the sandbox shared secret during development or any non-empty string for sandbox per docs). 4) Use that shared secret in the RVS verifyReceiptId URL: /developer/{shared-secret}/user/{user-id}/receiptId/{receipt-id}.

2. Add them to .dlt/secrets.toml

[sources.amazon_in_app_purchasing_source] shared_secret = "your_shared_secret_here"

dlt reads this automatically at runtime — never hardcode tokens in your pipeline script. For production environments, see setting up credentials with dlt for environment variable and vault-based options.


How do I set up and run the pipeline?

Set up a virtual environment and install dlt:

uv venv && source .venv/bin/activate uv pip install "dlt[workspace]"

1. Install the dlt AI Workbench:

dlt ai init --agent <your-agent> # <agent>: claude | cursor | codex

This installs project rules, a secrets management skill, appropriate ignore files, and configures the dlt MCP server for your agent. Learn more →

2. Install the rest-api-pipeline toolkit:

dlt ai toolkit rest-api-pipeline install

This loads the skills and context about dlt the agent uses to build the pipeline iteratively, efficiently, and safely. The agent uses MCP tools to inspect credentials — it never needs to read your secrets.toml directly. Learn more →

3. Start LLM-assisted coding:

Use /find-source to load data from the Amazon In-App Purchasing API into DuckDB.

The rest-api-pipeline toolkit takes over from here — it reads relevant API documentation, presents you with options for which endpoints to load, and follows a structured workflow to scaffold, debug, and validate the pipeline step by step.

4. Run the pipeline:

python amazon_in_app_purchasing_pipeline.py

If everything is configured correctly, you'll see output like this:

Pipeline amazon_in_app_purchasing_pipeline load step completed in 0.26 seconds 1 load package(s) were loaded to destination duckdb and into dataset amazon_in_app_purchasing_data The duckdb destination used duckdb:/amazon_in_app_purchasing.duckdb location to store data Load package 1749667187.541553 is LOADED and contains no failed jobs

Inspect your pipeline and data:

dlt pipeline amazon_in_app_purchasing_pipeline show

This opens the Pipeline Dashboard where you can verify pipeline state, load metrics, schema (tables, columns, types), and query the loaded data directly.


Python pipeline example

This example loads purchase_updates and rvs_verify_receipt from the Amazon In-App Purchasing API into DuckDB. It mirrors the endpoint and data selector configuration from the table above:

import dlt from dlt.sources.rest_api import RESTAPIConfig, rest_api_resources @dlt.source def amazon_in_app_purchasing_source(shared_secret=dlt.secrets.value): config: RESTAPIConfig = { "client": { "base_url": "For client-side Web App IAP library calls the Amazon Web App resources URL: https://resources.amazonwebapps.com/v1/latest/Amazon-Web-App-API.min.js (client library). For server-side receipt verification (RVS) use RVS endpoints: https://appstore-sdk.amazon.com/version/1.0/verifyReceiptId/... (production) and https://appstore-sdk.amazon.com/sandbox/version/1.0/verifyReceiptId/... (sandbox).", "auth": { "type": "api_key", "shared_secret": shared_secret, }, }, "resources": [ {"name": "purchase_updates", "endpoint": {"path": "(client) AmazonIapV2.getPurchaseUpdates(reset)", "data_selector": "receipts"}}, {"name": "rvs_verify_receipt", "endpoint": {"path": "version/1.0/verifyReceiptId/developer/{shared-secret}/user/{user-id}/receiptId/{receipt-id}"}} ], } yield from rest_api_resources(config) def get_data() -> None: pipeline = dlt.pipeline( pipeline_name="amazon_in_app_purchasing_pipeline", destination="duckdb", dataset_name="amazon_in_app_purchasing_data", ) load_info = pipeline.run(amazon_in_app_purchasing_source()) print(load_info)

To add more endpoints, append entries from the resource table to the "resources" list using the same name, path, and data_selector pattern.


How do I query the loaded data?

Once the pipeline runs, dlt creates one table per resource. You can query with Python or SQL.

Python (pandas DataFrame):

import dlt data = dlt.pipeline("amazon_in_app_purchasing_pipeline").dataset() sessions_df = data.purchase_updates.df() print(sessions_df.head())

SQL (DuckDB example):

SELECT * FROM amazon_in_app_purchasing_data.purchase_updates LIMIT 10;

In a marimo or Jupyter notebook:

import dlt data = dlt.pipeline("amazon_in_app_purchasing_pipeline").dataset() data.purchase_updates.df().head()

See how to explore your data in marimo Notebooks and how to query your data in Python with dataset.


What destinations can I load Amazon In-App Purchasing data to?

dlt supports loading into any of these destinations — only the destination parameter changes:

DestinationExample value
DuckDB (local, default)"duckdb"
PostgreSQL"postgres"
BigQuery"bigquery"
Snowflake"snowflake"
Redshift"redshift"
Databricks"databricks"
Filesystem (S3, GCS, Azure)"filesystem"

Change the destination in dlt.pipeline(destination="snowflake") and add credentials in .dlt/secrets.toml. See the full destinations list.


Troubleshooting

Authentication failures and shared secret errors

  • RVS returns HTTP 496 for invalid shared secret and HTTP 497 for invalid user id. Ensure you copy the exact Shared Secret from the Developer Console and URL-encode it when placing it in the path. For sandbox, the shared secret can be any non-empty string.

Receipt errors and statuses

  • RVS returns HTTP 400 when the receipt is invalid or not found, and HTTP 410 when the transaction is no longer valid (treated as canceled). Check receiptId and userId values from the client PurchaseResponse or PurchaseUpdatesResponse.

Rate limiting and throttling

  • RVS may return HTTP 429 when requests are throttled. Implement exponential backoff and reduce calling frequency.

Client-side delivery and deduplication

  • The client library delivers receipts via callbacks; receipts are unordered. Use receiptId to deduplicate and store fulfillment status. For consumables, if notifyFulfillment() is not called, getPurchaseUpdates() will continue to return the receipt until acknowledged.

Common API errors (summary):

  • 200 OK: success (RVS)
  • 400 Bad Request: invalid or not found receipt
  • 410 Gone: transaction no longer valid (canceled)
  • 429 Too Many Requests: throttled
  • 496 Invalid shared secret
  • 497 Invalid user ID
  • 500 Internal Server Error

Ensure that the API key is valid to avoid 401 Unauthorized errors. Also, verify endpoint paths and parameters to avoid 404 Not Found errors.


Next steps

Continue your data engineering journey with the other toolkits of the dltHub AI Workbench:

  • data-exploration — Build custom notebooks, charts, and dashboards for deeper analysis with marimo notebooks.
  • dlthub-runtime — Deploy, schedule, and monitor your pipeline in production.
dlt ai toolkit data-exploration install dlt ai toolkit dlthub-runtime install

Was this page helpful?

Community Hub

Need more dlt context for Amazon In-App Purchasing?

Request dlt skills, commands, AGENT.md files, and AI-native context.