SDK reference · Rails
x402Challenge
x402Challenge in @provenanceauth/rails/x402, Rails. Build the 402 a merchant returns: the PaymentRequired with the extension, its base64 PAYMENT-REQUIRED header, and the same object as an informational JSON body.
Signature
x402Challenge(opts: { resource: X402ResourceInfo | string; accepts: X402PaymentRequirements[]; error?: string; required?: boolean; extensions?: Record<string, X402Extension>; /** #110: the business's discovery block (`discoveryFields(profile).x402.profile`). */ profile?: DiscoveryBlock; }): { status: 402; headers: Record<string, string>; body: X402PaymentRequired }Parameters
opts{ resource: X402ResourceInfo | string; accepts: X402PaymentRequirements[]; error?: string; required?: boolean; extensions?: Record<string, X402Extension>; /** #110: the business's discovery block (`discoveryFields(profile).x402.profile`). */ profile?: DiscoveryBlock; }Required
Returns
{ status: 402; headers: Record<string, string>; body: X402PaymentRequired }
HTTP operation
Runs locally, with no request to the API.