Class X402::BSV::PayGateway ¶
Inherits: X402::BSV::Gateway
BSV-native payment gateway using Coinbase v2 headers.
Challenge: Payment-Required (v2 PaymentRequired JSON with extra.partialTx) Proof: Payment-Signature (v2 PaymentPayload JSON with rawtx + txid) Receipt: Payment-Response (settlement result JSON)
Server broadcasts via ARC. No nonces needed — ARC is the replay gate.
Constants¶
ASSET ¶
Not documented.
DEFAULT_ARC_TIMEOUT ¶
Not documented.
DEFAULT_ARC_WAIT_FOR ¶
Not documented.
DEFAULT_MAX_TIMEOUT_SECONDS ¶
Not documented.
SCHEME ¶
Not documented.
Attributes¶
arc_client [R] ¶
Returns the value of attribute arc_client.
arc_timeout [R] ¶
Returns the value of attribute arc_timeout.
arc_wait_for [R] ¶
Returns the value of attribute arc_wait_for.
binding_mode [R] ¶
Returns the value of attribute binding_mode.
settlement_worker [R] ¶
Returns the value of attribute settlement_worker.
Public Instance Methods¶
challenge_headers(rack_request, route) ¶
Build a 402 challenge with Coinbase v2 Payment-Required header. - @param rack_request [Rack::Request] - @param route [X402::Configuration::Route] - @return [Hash] challenge headers
initialize(arc_client:, arc_wait_for: = DEFAULT_ARC_WAIT_FOR, arc_timeout: = DEFAULT_ARC_TIMEOUT, binding_mode: = :strict, payee_locking_script_hex: = nil, wallet: = nil, challenge_secret: = nil, settlement_worker: = nil, txid_store: = nil) ¶
- @param
arc_client[#broadcast] ARC client for broadcasting - @param
arc_wait_for[String] ARC X-WaitFor header value - @param
arc_timeout[Integer] seconds before ARC timeout - @param
binding_mode[Symbol] :strict or :permissive for OP_RETURN binding - @param
payee_locking_script_hex[String, nil] payee script (falls back to config) - @param
settlement_worker[#enqueue, nil] async settlement worker - @param
txid_store[#seen?, #record!, nil] optional txid deduplication store. When provided, rejects proofs whose txid has already been settled. - @return [PayGateway] a new instance of PayGateway
proof_header_names() ¶
- @return [Array
] proof header names this gateway responds to
settle!(_header_name, proof_payload, rack_request, route) ¶
Verify and broadcast a Coinbase v2 payment. - @param _header_name [String] which proof header matched - @param proof_payload [String] base64-encoded payment payload - @param rack_request [Rack::Request] - @param route [X402::Configuration::Route] - @raise [VerificationError] on invalid payment, insufficient amount, or broadcast failure - @return [SettlementResult]