Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
194 changes: 194 additions & 0 deletions cookbook/facilitators/using-autoincentive.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
---
title: "AutoIncentive"
description: "Integrate AutoIncentive facilitator for x402 payment processing"
---

AutoIncentive is a hosted facilitator service that streamlines x402 payment processing. By using AutoIncentive's endpoints, you can offload payment verification and settlement without needing to operate your own facilitator infrastructure.

## Highlights

- **Multi-Chain Support** — Base, SKALE Base, and Solana from a single facilitator endpoint
- **Gasless on SKALE** — Zero gas fees for settlement on SKALE Base, powered by CREDITS
- **x402 v1 & v2** — Supports both legacy network names and CAIP-2 format
- **Free to use** — No fees charged on top of payments

## Supported Networks and Tokens
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering these are the official SKALE Docs its only needed to share the supported tokens on SKALE Base -> in this case USDC; Please remove the tokens from other chains

In the future if autoincentive supports more SKALE Base tokens as x402 payment (ex: SKL, USDT, etc) it can be added to the table

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified


| Network | Network Identifier | Token | Signer Address |
|---------|-------------------|-------|----------------|
| SKALE Base Mainnet | `skale-base` / `eip155:1187947933` | USDC | `0x12a2A9353fD1bAdb2eB9DbE9Cb75d73e527D2763` |

## Prerequisites

- Node.js and npm installed
- A SKALE Chain endpoint
- Basic understanding of x402 protocol

## Configuration

### Environment Variables

Create a `.env` file with the following configuration:

```bash
# Receiver address for the x402 payment
RECEIVING_ADDRESS=0xAddress_Receiving_Payment

# please don't share your private key with anyone
PRIVATE_KEY=0xyour_pk
```

### Dependencies

Install the x402 client library and viem:

```bash
npm install x402 viem
```

## Integration with AutoIncentive

<Tabs>
<Tab title="Server Setup">

```typescript
import express from "express";
import { paymentMiddleware } from "x402/express";
import "dotenv/config";

const app = express();

const receiver_address = process.env.RECEIVING_ADDRESS || "0xsome_default_address";
const facilitator = "https://facilitator.x402endpoints.online";

app.get("/api/free", (req, res) => {
res.json({
type: "free",
message: "This is free data that does not require payment",
timestamp: new Date().toISOString(),
data: {
temperature: 72,
humidity: 45,
conditions: "Sunny",
},
});
});

// Premium endpoint with payment required
app.get(
"/api/premium",
paymentMiddleware(facilitator, {
network: "eip155:1187947933",
asset: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20",
amount: "1000",
payTo: receiver_address,
description: "Premium weather data",
mimeType: "application/json",
maxTimeoutSeconds: 60,
resource: "/api/premium",
}),
(req, res) => {
res.json({
type: "paid",
message: "This is paid data that requires x402 payment",
timestamp: new Date().toISOString(),
data: {
temperature: 72,
humidity: 45,
conditions: "Sunny",
},
});
}
);

app.listen(3000, () => {
console.log("Listening on http://localhost:3000");
});
```

</Tab>
<Tab title="Client Setup">

```typescript
import { wrapFetch } from "x402";
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import "dotenv/config";

const pk = process.env.PRIVATE_KEY;

if (!pk) {
throw new Error("PRIVATE_KEY must be set in your environment");
}

const account = privateKeyToAccount(pk as `0x${string}`);
const walletClient = createWalletClient({
account,
transport: http("https://skale-base.skalenodes.com/v1/base"),
});

const fetchWithPayer = wrapFetch(fetch, walletClient);

const url = "http://localhost:3000/api/premium";
const response = await fetchWithPayer(url);

if (response.ok) {
const data = await response.json();
console.log("Response data:", data);
} else {
console.error(`Error: ${response.statusText}`);
}
```

</Tab>
</Tabs>

## Troubleshooting

### Connection Issues

If you cannot connect to AutoIncentive:

1. Verify the facilitator URL is correct
2. Check network connectivity
3. Ensure API credentials are valid
4. Review firewall settings

### Payment Failures

Common causes and solutions:

| Issue | Solution |
|-------|----------|
| Invalid signature | Verify wallet configuration and signing |
| Insufficient balance | Ensure payer has enough USDC |
| Network mismatch | Check chain ID matches configuration |
| Expired authorization | Increase `maxTimeoutSeconds` |

## Next Steps

<CardGroup cols={2}>
<Card title="SKALE Supported Facilitators" icon="dollar-sign" href="/get-started/agentic-builders/facilitators">
Alternative facilitator with advanced features
</Card>
<Card title="Run Your Own" icon="server" href="/cookbook/x402/facilitator">
Deploy your own facilitator infrastructure
</Card>
<Card title="Accept Payments" icon="dollar-sign" href="/cookbook/x402/accepting-payments">
Protect endpoints with payment middleware
</Card>
<Card title="Make Payments" icon="credit-card" href="/cookbook/x402/buying">
Build clients that handle x402 payments
</Card>
</CardGroup>

## Resources

- [AutoIncentive GitHub](https://github.com/Concorde89/facilitator)
- [x402 Protocol Specification](https://x402.org)

---

<Note>
This entity -- AutoIncentive -- is deployed and actively supporting SKALE. These are 3rd party services that may have their own terms and conditions and privacy policies. Use these services at your own risk. AI and agents is a highly experimental space; the 3rd party software solutions may have bugs or be unaudited. You and your agents and your customers use all 3rd party services chosen at your own risk and per their terms.
</Note>
3 changes: 2 additions & 1 deletion docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@
"cookbook/facilitators/using-kobaru",
"cookbook/facilitators/using-payai",
"cookbook/facilitators/using-relai",
"cookbook/facilitators/using-x402x"
"cookbook/facilitators/using-x402x",
"cookbook/facilitators/using-autoincentive"
]
},
{
Expand Down
1 change: 1 addition & 0 deletions get-started/agentic-builders/facilitators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ On SKALE, facilitators support both SKALE Base (Mainnet) and SKALE Base Sepolia
| Kobaru | https://gateway.kobaru.io | [Kobaru Demo](/cookbook/facilitators/using-kobaru) | BITE v1 |
| PayAI | https://facilitator.payai.network | [PayAI Demo](/cookbook/facilitators/using-payai) | - |
| x402x | https://facilitator.x402x.dev | [x402x Demo](/cookbook/facilitators/using-x402x) | - |
| AutoIncentive | https://facilitator.x402endpoints.online | [AutoIncentive Demo](/cookbook/facilitators/using-autoincentive) | - |

<Note>
Does your facilitator support SKALE? Submit a PR at https://github.com/skalenetwork/docs.skale.space and add your facilitator!
Expand Down