x402/go/errors.go

132 lines
3.9 KiB
Go
Raw Permalink Normal View History

Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
package x402
import "fmt"
// PaymentError represents a payment-specific error
type PaymentError struct {
Code string `json:"code"`
Message string `json:"message"`
Details map[string]interface{} `json:"details,omitempty"`
}
func (e *PaymentError) Error() string {
return fmt.Sprintf("%s: %s", e.Code, e.Message)
}
// Common error codes
const (
ErrCodeInvalidPayment = "invalid_payment"
ErrCodePaymentRequired = "payment_required"
ErrCodeInsufficientFunds = "insufficient_funds"
ErrCodeNetworkMismatch = "network_mismatch"
ErrCodeSchemeMismatch = "scheme_mismatch"
ErrCodeSignatureInvalid = "signature_invalid"
ErrCodePaymentExpired = "payment_expired"
ErrCodeSettlementFailed = "settlement_failed"
ErrCodeUnsupportedScheme = "unsupported_scheme"
ErrCodeUnsupportedNetwork = "unsupported_network"
)
// Facilitator error constants
const (
ErrInvalidVersion = "invalid_version"
ErrInvalidV1Payload = "invalid_v1_payload"
ErrInvalidV1Requirements = "invalid_v1_requirements"
ErrInvalidV2Payload = "invalid_v2_payload"
ErrInvalidV2Requirements = "invalid_v2_requirements"
ErrNoFacilitatorForNetwork = "no_facilitator_for_network"
ErrInvalidResponse = "invalid_response"
)
// Server error constants
const (
ErrFailedToMarshalPayload = "failed_to_marshal_payload"
ErrFailedToMarshalRequirements = "failed_to_marshal_requirements"
)
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
// NewPaymentError creates a new payment error
func NewPaymentError(code, message string, details map[string]interface{}) *PaymentError {
return &PaymentError{
Code: code,
Message: message,
Details: details,
}
}
// VerifyError represents a payment verification failure
// All verification failures (business logic and system errors) are returned as errors
type VerifyError struct {
InvalidReason string // Error reason/code (e.g., "insufficient_balance", "invalid_signature")
Payer string // Payer address (if known)
InvalidMessage string // Optional invalid message details
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
}
// Error implements the error interface
func (e *VerifyError) Error() string {
if e.InvalidMessage != "" {
return fmt.Sprintf("%s: %s", e.InvalidReason, e.InvalidMessage)
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
}
return e.InvalidReason
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
}
// NewVerifyError creates a new verification error
//
// Args:
//
// reason: Error reason/code
// payer: Payer address (empty string if unknown)
// network: Network identifier (empty string if unknown)
// message: Optional invalid message details
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
//
// Returns:
//
// *VerifyError
func NewVerifyError(reason string, payer string, message string) *VerifyError {
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
return &VerifyError{
InvalidReason: reason,
Payer: payer,
InvalidMessage: message,
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
}
}
// SettleError represents a payment settlement failure
// All settlement failures (business logic and system errors) are returned as errors
type SettleError struct {
ErrorReason string // Error reason/code (e.g., "transaction_failed", "insufficient_balance")
Payer string // Payer address (if known)
Network Network // Network identifier
Transaction string // Transaction hash (if settlement was attempted)
ErrorMessage string // Optional error message details
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
}
// Error implements the error interface
func (e *SettleError) Error() string {
if e.ErrorMessage != "" {
return fmt.Sprintf("%s: %s", e.ErrorReason, e.ErrorMessage)
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
}
return e.ErrorReason
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
}
// NewSettleError creates a new settlement error
//
// Args:
//
// reason: Error reason/code
// payer: Payer address (empty string if unknown)
// network: Network identifier
// transaction: Transaction hash (empty string if not submitted)
// err: Optional underlying error
//
// Returns:
//
// *SettleError
func NewSettleError(reason string, payer string, network Network, transaction string, message string) *SettleError {
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
return &SettleError{
ErrorReason: reason,
Payer: payer,
Network: network,
Transaction: transaction,
ErrorMessage: message,
Development v2 (#705) * chore: move packages, examples and e2e clients/servers/facilitators to legacy subfolders * feat: added @x402/core to /typescript/packages * feat: added @x402/evm to /typescript/packages/mechanism * feat: added @x402/svm to /typescript/packages/mechanism * feat: added @x402/extensions to /typescript/packages * feat: added @x402/fetch to /typescript/packages/http * feat: added @x402/axios to /typescript/packages/http * feat: added @x402/paywall to /typescript/packages/http * feat: added @x402/express to /typescript/packages/http * feat: added @x402/hono to /typescript/packages/http * feat: added @x402/next to /typescript/packages/http * chore: update /typescript pnpm packaging * feat: added core files to /go * feat: added evm mechanism to /go * feat: added svm mechanism to /go * feat: added extensions to /go * feat: added gin to /go/http * feat: added tests to /go * feat: rewrote e2e test suite system * feat: added axios client to e2e suite * feat: added fetch client to e2e suite * feat: added go http client to e2e suite * feat: added express server to e2e suite * feat: added hono server to e2e suite * feat: added next server to e2e suite * feat: added gin server to e2e suite * feat: added typescript facilitator to e2e suite * feat: added go facilitator to e2e suite * feat: added fetch example to examples/typescript/clients * feat: added axios example to examples/typescript/clients * feat: added advanced example to examples/typescript/clients * feat: added custom example to examples/typescript/clients * feat: added express example to examples/typescript/servers * feat: added hono example to examples/typescript/servers * feat: added advanced example to examples/typescript/servers * feat: added custom example to examples/typescript/servers * feat: added facilitator example to examples/typescript * chore: update /examples/typescript pnpm packaging * feat: added http client to examples/go/clients * feat: added advanced client to examples/go/clients * feat: added custom client to examples/go/clients * feat: added gin server to examples/go/servers * feat: added advanced server to examples/go/servers * feat: added custom server to examples/go/servers * feat: added facilitator to examples/go * chore: updated github workflows * fix: typescript examples fotmat/lint * v2: next example (#706) * fix legacy example builds * add next example * fix format * upgrade to next 16 * fix legacy build * fix e2e tests * V2: next api wrapper (#707) * add next route wrapper * add protected api to example page * add unit tests * fix missing settle failure check * added e2e tests for withX402 * add SettleResponse to ProcessSettleResultResponse * add requirements to payment-header * feat: add v2 support to x402.org facilitator * feat: dynamically load bazaar extension in Next only when used * fix: x402Facilitator in typescript calling onAfterVerify instead on onVerifyFailure on failure * feat: add ERC1271 and ERC6492 support to Typescript facilitator * feat: update typescript facilitator example & e2e test for ERC1271/ERC6492 support * feat: add ERC1271 and ERC6492 support to Go facilitators * feat: update go facilitator example & e2e test for ERC1271/ERC6492 support * v2: express fixes + unit tests (#712) * add express fixes from v1 * add units test for express/hono * added fetch/axios unit tests * v2: Clean up paywall (#710) * Remove cdpClientKey and sessionTokenEndpoint from PaywallConfig Remove Onramp functionality from EvmPaywall Remove Coinbase fields from paywall template generation * Migrate site to @x402/next with v2 protocol support * Clean up tests * remove CDP onramp from core paywall * Update templates and build process * Format * Lockfile * mock templates for CI * Format * Generate new templates * Format * v2: facilitator sync fix (#716) * update next/react versions * update site to next 16, tailwind 4 and fix env vars * fix initializeOnStart pattern * security: bump quic-go dependency for security fix GHSA-47m2-4cr7-mhcw * v2:fix ts advanced/custom examples (#717) * fix ts examples * add clients/advanced/preferred-network example * feat: improved e2e cli for external facilitator testing * feat: updated evm & svm signer interfaces in go * feat: updated evm & svm signer interfaces in typescript * feat: reverted SupportedKind's kinds structure in go * feat: reverted SupportedKind's kinds structure in typescript * feat: refactor facilitator SVM signer interface in typescript * go example fixes (#719) * feat: cleanup go bazaar extension * V2: docs update (#729) * ts example docs * improve ts package docs * feat: dynamic bazaar import for all server middleware * feat: allow dynamic response building for 402 response in typescript * feat: allow dynamic response building for 402 response in go * feat: added withBazaar HTTPFacilitatorClient wrapper * feat: added linting to go * fix: lint go * improve go example docs (#733) * feat: Solana PR review feedback in typescript * feat: Solana PR review feedback in go * fix: locks & paywall gen after rebase off main * fix: format * docs: improve @x402/extensions README with comprehensive documentation (#731) * First draft of contributor docs (#738) Correct ts contributing Clean up contribution guidelines * feat: updated specs for v2 * fix: merge with main, fixed lock * v2: go settlement failure and initOnStart fixes (#720) * go settlement failure and initOnStart fixes * update go unit tests * update readmes * feat: review & improve examples & READMEs * v2: add multiple payment options for go (#743) * add multiple payment options for go * fix SyncFacilitatorOnStart * v2: add hooks for advanced go example (#745) * add hooks for advanced go example * fix legacy ts deps * feat: added server initialization validation * feat: added @x402 package workflows * v2: add miniapp and mcp examples (#746) * add miniapp example * fix format * add mcp example * fix format * v2: add manifest to miniapp example (#751) * add manifest to miniapp * fix format * feat: x402 website redesign (#750) * port new website to public repo * chore: update pnpm-lock.yaml with motion dependency * feat: add x402 V2 launch blog post and update hero code snippet - Add /writing/x402-v2-launch blog post page - Add blog images (blog_intro.png, blog_x402_layers.png, homepage_build5.png) - Enable Writing nav link in NavBar and Footer - Update hero code snippet to show V2 SDK usage - Fix CodeSnippet to support multi-line code * feat: edit nav for mobile * Revert "feat: edit nav for mobile" This reverts commit 475999a2a84f1fab875cd0fe2bb74d44dba7e1bd. * feat: add ecosystem page and minor home page tweaks * feat: fix typography in ecosystem * homepage qa fixes * feat: add ecosystem icons and fix halftone * cleanup assets * fix: minor bug on faq * feat: add hamburger menu to mobile * Update README (#755) * Update readme * Install instructions and typos * feat: update site sample code & reduce supported networks * fix: v1 header in README updated to v2 --------- Co-authored-by: phdargen <p.dargent@cern.ch> Co-authored-by: A. McDermott <amanda.p.mcdermott@gmail.com> Co-authored-by: Vedant Anand <136731196+VedantAnand17@users.noreply.github.com> Co-authored-by: Faris Habib <frs@hbb.dev> Co-authored-by: erikreppel-cb <erik.reppel@coinbase.com>
2025-12-11 07:41:57 -08:00
}
}