> For the complete documentation index, see [llms.txt](https://docs.hyperswitch.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hyperswitch.io/integrations/connectors-integrations/payment-processor-capabilities/available-connectors/affirm.md).

# Affirm

Offer Affirm pay later payments.

Offer Affirm pay later payments in USD through a direct connection to Affirm. Checkout is a redirect: the customer completes the Affirm checkout and returns to Hyperswitch, which then confirms the transaction. Payments support sequential automatic or manual capture, and refunds are supported. Mandates are not supported.

### Status and capabilities

**Integration status:** beta

**Category:** payment gateway

**Webhook flows:** None declared in code

| Payment method | Type   | Mandates      | Refunds   | Capture methods              | Countries | Currencies |
| -------------- | ------ | ------------- | --------- | ---------------------------- | --------- | ---------- |
| pay later      | Affirm | not supported | supported | sequential automatic, manual | -         | USD        |

The Countries column is empty because the direct Affirm connector's payment method filter restricts currency to USD but sets no country. Hyperswitch calls Affirm's US API (`api.affirm.com`), so use this connector for US Affirm merchant accounts. See the [payment method filter](https://github.com/juspay/hyperswitch/blob/d8b6ebe773690aa37cf249b2992c2358dbd7f438/config/deployments/production.toml#L420-L421) and the [production base URL](https://github.com/juspay/hyperswitch/blob/d8b6ebe773690aa37cf249b2992c2358dbd7f438/config/deployments/production.toml#L40).

### Authentication

Supply a **Public Key** and **Private Key**. Hyperswitch joins them in that order as `<Public Key>:<Private Key>`, Base64-encodes the pair, and sends `Authorization: Basic <encoded value>`. See [`AffirmAuthType::try_from()`](https://github.com/juspay/hyperswitch/blob/d8b6ebe773690aa37cf249b2992c2358dbd7f438/crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs#L215-L230), [`build_headers()`](https://github.com/juspay/hyperswitch/blob/d8b6ebe773690aa37cf249b2992c2358dbd7f438/crates/hyperswitch_connectors/src/connectors/affirm.rs#L90-L107), and [`get_auth_header()`](https://github.com/juspay/hyperswitch/blob/d8b6ebe773690aa37cf249b2992c2358dbd7f438/crates/hyperswitch_connectors/src/connectors/affirm.rs#L127-L144).

### Before you start

1. Sign in to the [Hyperswitch control center](https://app.hyperswitch.io/).
2. Get your **Public Key** and **Private Key** from **API keys** in the Affirm merchant portal: [sandbox](https://sandbox.affirm.com/dashboard/apikeys) or [production](https://www.affirm.com/dashboard/apikeys). Keep the Private Key server-side only. See [Affirm API keys](https://docs.affirm.com/developers/docs/api-keys).

To connect Affirm to your Hyperswitch account, follow [Activate a connector on Hyperswitch](/integrations/connectors-integrations/activate-connector-on-hyperswitch.md), then return here for what Affirm supports.

### Webhooks

Affirm webhooks are not supported. Use payment sync and refund sync for status updates. The connector's webhook handlers all return `WebhooksNotImplemented`; see [`IncomingWebhook for Affirm`](https://github.com/juspay/hyperswitch/blob/d8b6ebe773690aa37cf249b2992c2358dbd7f438/crates/hyperswitch_connectors/src/connectors/affirm.rs#L797-L821).

### Source reference

Checkout, authentication, and webhook behavior on this page is tied to Hyperswitch `d8b6ebe773690aa37cf249b2992c2358dbd7f438`. See [Affirm connector source](https://github.com/juspay/hyperswitch/blob/d8b6ebe773690aa37cf249b2992c2358dbd7f438/crates/hyperswitch_connectors/src/connectors/affirm.rs) and [Affirm transformers](https://github.com/juspay/hyperswitch/blob/d8b6ebe773690aa37cf249b2992c2358dbd7f438/crates/hyperswitch_connectors/src/connectors/affirm/transformers.rs).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.hyperswitch.io/integrations/connectors-integrations/payment-processor-capabilities/available-connectors/affirm.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
