# Developer Configuration Layer

#### **Overview**

To make 402Gate developer-friendly, it includes a **configuration SDK** and **endpoint templates** that make any HTTP service instantly monetizable.

#### **Features**

* Simple middleware for Node.js / Next.js / Express.
* Built-in helpers to attach pricing logic per endpoint.
* Automatic generation of 402 responses and verification flow.
* TypeScript support for strict typing.

#### **Example Implementation**

```js
import { create402Middleware } from "@402gate/sdk";

app.use("/api/premium", create402Middleware({
  price: 0.001,
  token: "402G",
  recipient: "MERCHANT_PUBKEY",
  verifyOnChain: true
}));
```

#### **SDK Components**

* `create402Middleware()` — wrap protected endpoints.
* `verifyPayment()` — validate tx proof.
* `fetchWith402()` — client-side auto-retry for 402 responses.

#### **Developer Experience**

With the SDK, any developer can turn their REST API into a **Web3-native pay-per-use service** in minutes  without building a smart contract or handling complex crypto logic.


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.402gate.com/core-protocol/developer-configuration-layer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
