Payment-method icon

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, 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. 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.
API credentials Your Management API credential must have the following role:
  • Management API — Payment methods read
Setup steps Before you begin, add Affirm in your Customer Area.

Get your Affirm public API key

To get your Affirm public API key:

  1. Make a 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.

See also