> 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/external_gateways.md).

# External gateways

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

External payment gateways let you integrate any payment service that is not available out-of-the-box (even your custom one) and safely process any type of external payment.

To create an external gateway choose a meaningful name that helps you identify it within your organization and specify the endpoints you have configured externally. You need to provide your gateway's **authorize**, **capture**, **void**, **refund**, and **customer token** URLs. Your external endpoint will be responsible for the actual integration with the payment gateway. The payment source associated with the order must be an [external payment](/core-api-reference/external_payments.md).

External gateways are subject to a [circuit breaker](/core/external-resources.md#circuit-breaker) check: if the call to your external endpoint fails consecutively more than **30** times, the circuit breaker opens and any further request to the resource will be skipped. You can check the circuit breaker current status by fetching the `circuit_state` and `circuit_failure_count` attributes or manually reset it by passing the `_reset_circuit` trigger (the circuit is anyway automatically reset anytime a call to your external endpoint succeeds before reaching the counter's threshold).

External gateways process payments **synchronously** by default. You can use the webhook endpoint URL Commerce Layer exposes to manage [async payments](/core/external-resources/external-payment-gateways.md#asynchronous-payments).

<details>

<summary>How-to</summary>

Check the related [guide](/core/external-resources/external-payment-gateways.md) for any additional info on how to configure your external payment gateway and integrate it with Commerce Layer.

</details>


---

# 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/external_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.
