> For the complete documentation index, see [llms.txt](https://docs.commercelayer.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.commercelayer.io/core-api-reference/payment_gateways.md).

# Payment gateways

The payment gateway object and the allowed CRUD operations on the related resource endpoint

Commerce Layer is integrated out-of-the-box with some of the most common payment gateways, all compliant with the [PSD2 European regulation](https://ec.europa.eu/info/law/payment-services-psd-2-directive-eu-2015-2366_en) so that you can implement a payment flow that supports [SCA](https://en.wikipedia.org/wiki/Strong_customer_authentication) and [3DS2](https://3dsecure2.com/) by using the specific gateway's official JS SDK.

The currently supported gateways are:

* [Adyen](/core-api-reference/adyen_gateways.md)
* [Axerve](/core-api-reference/axerve_gateways.md)
* [Braintree](/core-api-reference/braintree_gateways.md)
* [Checkout.com](/core-api-reference/checkout_com_gateways.md)
* [Klarna](/core-api-reference/klarna_gateways.md)
* [PayPal](/core-api-reference/paypal_gateways.md)
* [Satispay](/core-api-reference/satispay_gateways.md)
* [Stripe](/core-api-reference/stripe_gateways.md)

Other types of gateways are also available, such as:

* [External gateways](/core-api-reference/external_gateways.md) — to integrate any other payment service that is not available out-of-the-box (even your custom one).
* [Manual gateways](/core-api-reference/manual_gateways.md) — useful to process wire transfers, cash payments, and other kinds of manual payments.

You can set up a payment gateway from the admin UI. All you need to do is select the type of gateway you want to use and provide all the credentials requested by the selected payment service.

Configuring a payment gateway for a market lets you safely process payments through the API. You can connect different gateways to different markets through the available [payment methods](/core-api-reference/payment_methods.md).

## Error codes

When a gateway returns a structured error along with an `error_code`, that code is appended to the failure message (e.g. `invalid payment_token (INVALID_AUTH)`) and also exposed as `error_code` within the `meta` of the returned error, regardless of the gateway type.

{% hint style="info" %}
This only applies to the immediate error response returned by a synchronous request — the [resource error](/core-api-reference/resource_errors.md) stored for later inspection still keeps the plain merchant message, without the appended code.
{% endhint %}

## Idempotency keys

With **Adyen**, **Checkout.com**, **Klarna**, **PayPal**, **Satispay**, **Stripe**, and **external gateways**, captures, voids, refunds, and reversals are sent to the payment service with an idempotency key, so that an accidental duplicate — a double click, a client retry after a timeout, or a retried background job — is recognized by the gateway and not processed twice. The key stays stable for the number of minutes set by the `idempotency_window_mins` attribute (**1 hour** by default) and changes after that, so a deliberate retry of a failed operation is processed as a new attempt instead of being answered with the stored result of the first one.

{% hint style="info" %}
Set `idempotency_window_mins` on a specific gateway endpoint to tune the idempotency window for that gateway.
{% endhint %}

{% hint style="warning" %}
Authorizations keep a key that never rotates, so that a shopper resubmitting an identical checkout is not charged twice.
{% endhint %}

<details>

<summary>Data model</summary>

Check the related [ER diagram](/data-model/payments-and-tax/payment-gateways.md) and explore the flowchart that illustrates how the payment gateway resource relates to the other API entities.

</details>

<details>

<summary>How-to</summary>

Check the related [guide](/how-tos/placing-orders/payments.md) to learn more about how Commerce Layer handles the server-side part of the integration process with each specific gateway.

</details>

{% hint style="info" %}
This is an **immutable API**, meaning that create, update, and delete operations are not allowed on this endpoint. You can only fetch a list of payment gateways or a single payment gateway object. Refer to the specific gateway endpoints for the full set of available CRUD actions.
{% endhint %}


---

# 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.commercelayer.io/core-api-reference/payment_gateways.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.
