Skip to main content

parse_payment_required

Function parse_payment_required 

Source
pub async fn parse_payment_required(
    response: Response,
) -> Option<PaymentRequired>
Available on crate feature client only.
Expand description

Parses a 402 Payment Required response into a proto::PaymentRequired.

Tries to extract V2 payment requirements from the Payment-Required header (base64-encoded JSON) first, then falls back to parsing the response body as plain JSON. This matches the Go SDK’s handleV2Payment which also tries header first then body.