Menu

Why does my x402 endpoint fail? A debugging checklist
πŸ“°

Why does my x402 endpoint fail? A debugging checklist

DEV Community: webdevΒ·Frits ZwagerΒ·15 days ago
#Q5JABxd4
#devtowebdev#devto#dev#payment#facilitator
Reading 0:00
15s threshold

When "the x402 payment fails", one of five steps broke, and each one fails in its own way. Find the step first, then the fix. In the order a paying agent goes through them:

Step What the agent sees when it breaks Check it with

1. The URL answers 402 404, 401, a login page, or 200 for free curl -i with the listed method

2. The 402 is one a client accepts The client throws before it signs A free 402 check

3. The payment reaches your server A new 402 right after paying, nothing settled Your log: is PAYMENT-SIGNATURE there?

4. The facilitator verifies and settles it A 402 with an error reason such as insufficient_funds The errorReason ; the facilitator's GET /supported

5. Your route answers after settling Paid, then a 400, 404 or 500 PAYMENT-RESPONSE and the transaction on-chain

1. Does the URL answer 402?

Call it the way the listing says, with no payment: curl -i https://api.example.com/v1/price?symbol=BTC . You want 402 and a PAYMENT-REQUIRED header.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.