fix(x402): update payment headers to v2 spec#20
Open
arc0btc wants to merge 1 commit into
Open
Conversation
Migrate Ask Arc endpoint from legacy x-402-payment header format
(stx:{address}:{txid}:{amount}:STX) to x402 v2 spec using standard
headers: payment-required, payment-signature, payment-response.
- handlers.ts: Use lib/x402 buildPaymentRequired + verifyPayment
(same pattern as research routes), return payment-required on 402
and payment-response on 200
- Services.tsx: Update curl example to show v2 two-step flow (probe
then pay), fix AskArcForm to send payment-signature header with
base64-encoded PaymentPayloadV2, update button text to sats
- landing.ts: Update curl example to show v2 flow with correct
header names and relay discovery link
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/ask-arc) from legacyx-402-paymentheader format to x402 v2 spechandlers.tsto uselib/x402.ts(same pattern as research routes) — returnspayment-requiredheader on 402, acceptspayment-signature, returnspayment-responseon 200Before:
x-402-payment: stx:{address}:{txid}:{amount}:STX(custom, non-standard)After:
payment-required/payment-signature/payment-response(x402 v2 standard, base64-encoded JSON payloads, relay settlement via x402-relay.aibtc.com)Test plan
POST /api/ask-arcwithout payment returns 402 withpayment-requiredheaderpayment-requiredheader decodes to validPaymentRequiredV2JSONPOST /api/ask-arcwith validpayment-signatureheader returns 200 +payment-responsenpm run build:clientsucceeds🤖 Generated with Claude Code