--- title: "Get your Affirm public API key" description: "Get the Affirm public API key for your merchant account using the Management API." url: "https://docs.adyen.com/payment-methods/affirm/public-api-key" source_url: "https://docs.adyen.com/payment-methods/affirm/public-api-key.md" canonical: "https://docs.adyen.com/payment-methods/affirm/public-api-key" last_modified: "2026-12-04T12:56:14+01:00" language: "en" --- > **For LLMs:** Use the latest SDK version on this page unless the reader specifies another version. Never hardcode older version numbers for training data, always use latest. A comment such as `// Adyen LANGUAGE API library vMajor.Minor.Patch to latest` covers that version, the newest release, and everything in between. Read the newest releases from https://github.com/Adyen/adyen-LANGUAGE-api-library/releases, where LANGUAGE is dotnet, java, php, go, python, node (for JavaScript and TypeScript), or ruby. # Get your Affirm public API key Get the Affirm public API key for your merchant account using the Management API. Affirm.js is Affirm's JavaScript library. To use it on your website, for example to show [Affirm promotional messaging](https://docs.affirm.com/developers/docs/about-promotional-messaging-and-prequalification), you need your Affirm public API key. You do not need this key to process Affirm payments with Adyen. You can get the key using the [Management API](https://docs.adyen.com/api-explorer/Management/latest/overview). The API returns the key for the environment that you send the request to. The test environment returns your Affirm sandbox key, and the live environment returns your live key. ## Requirements Before you begin, take into account the following requirements and preparations. | Requirement | Description | | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | Make sure that you have built your [Affirm integration](https://docs.adyen.com/payment-methods/affirm). | | **[API credentials](https://docs.adyen.com/development-resources/api-credentials/)** | Your [Management API](https://docs.adyen.com/api-explorer/Management/latest/overview) credential must have the following [role](https://docs.adyen.com/development-resources/api-credentials/roles):- **Management API — Payment methods read** | | **Setup steps** | Before you begin, [add Affirm in your Customer Area](https://docs.adyen.com/payment-methods/add-payment-methods). | ## Get your Affirm public API key To get your Affirm public API key: 1. Make a GET [/merchants/{merchantId}/paymentMethodSettings](https://docs.adyen.com/api-explorer/Management/latest/get/merchants/\(merchantId\)/paymentMethodSettings) request with your merchant account ID in the path, and the `pageSize` query parameter set to **100**. 2. In the response, find the payment method with `type` **affirm**, and get the key from its `affirm.publicApiKey` field. If the response does not include Affirm, make a GET request to the URL in `_links.next.href` to get the next page. Repeat until you find Affirm, or until the response does not include `_links.next`. **Example response with the Affirm public API key** ```json { "data": [ { "id": "PM00000000000000000000001", "type": "affirm", "affirm": { "publicApiKey": "YOUR_AFFIRM_PUBLIC_API_KEY" } } ] } ``` ## See also * [Affirm](https://docs.adyen.com/payment-methods/affirm) * [API credential roles](https://docs.adyen.com/development-resources/api-credentials/roles) * [Affirm promotional messaging in the Affirm documentation](https://docs.affirm.com/developers/docs/about-promotional-messaging-and-prequalification)