Function: isSettlementPending()
function isSettlementPending(response): response is { errorMessage?: string; errorReason: "invalid_exact_canton_missing_proof" | "invalid_exact_canton_malformed_payload" | "invalid_exact_canton_signature_invalid" | "invalid_exact_canton_amount_mismatch" | "invalid_exact_canton_merchant_mismatch" | "invalid_exact_canton_instrument_id_mismatch" | "invalid_exact_canton_preapproval_missing" | "invalid_exact_canton_fee_payer_mismatch" | "invalid_exact_canton_expired" | "invalid_exact_canton_execute_before_too_far" | "invalid_exact_canton_insufficient_inputs" | "invalid_exact_canton_memo_mismatch" | "invalid_exact_canton_merchant_not_registered" | "invalid_exact_canton_self_payment" | "invalid_exact_canton_execute_failed" | "unexpected_canton_ledger_error" | "settlement_pending" | "invalid_network" | "unsupported_scheme" | "insufficient_funds" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "unexpected_verify_error" | "unexpected_settle_error" | "invalid_exact_canton_synchronizer_mismatch"; extensions?: { [key: string]: unknown }; network: string; payer?: string; success: false; transaction: string } & { errorReason: "settlement_pending" };Defined in: packages/x402-core/src/types/facilitator.ts:298
True for a settlement_pending answer: the transaction was relayed and may still commit, so the payment must not be treated as failed and the payer must not be asked to sign again. The spec requires such an answer to carry a non-empty transaction and network; one missing either of them, or with either empty, is read as a plain failure.
Both are checked at runtime even though the type requires them: the client hands back the facilitator's body without validating it.
Parameters
response
| { amount?: string; extensions?: { [key: string]: unknown; }; network: string; payer?: string; success: true; transaction: string; } | { errorMessage?: string; errorReason: | "invalid_exact_canton_missing_proof" | "invalid_exact_canton_malformed_payload" | "invalid_exact_canton_signature_invalid" | "invalid_exact_canton_amount_mismatch" | "invalid_exact_canton_merchant_mismatch" | "invalid_exact_canton_instrument_id_mismatch" | "invalid_exact_canton_preapproval_missing" | "invalid_exact_canton_fee_payer_mismatch" | "invalid_exact_canton_expired" | "invalid_exact_canton_execute_before_too_far" | "invalid_exact_canton_insufficient_inputs" | "invalid_exact_canton_memo_mismatch" | "invalid_exact_canton_merchant_not_registered" | "invalid_exact_canton_self_payment" | "invalid_exact_canton_execute_failed" | "unexpected_canton_ledger_error" | "settlement_pending" | "invalid_network" | "unsupported_scheme" | "insufficient_funds" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "unexpected_verify_error" | "unexpected_settle_error" | "invalid_exact_canton_synchronizer_mismatch"; extensions?: { [key: string]: unknown; }; network: string; payer?: string; success: false; transaction: string; }
Type Literal
{ amount?: string; extensions?: { [key: string]: unknown; }; network: string; payer?: string; success: true; transaction: string; }
amount?
string = ...
The amount settled, in atomic units, as the requirements' amount is.
extensions?
{ [key: string]: unknown; } = ...
network
string = ...
payer?
string = ...
Optional in x402 v2, so a facilitator may leave it out.
success
true = ...
transaction
string = ...
Canton updateId of the executed transaction.
Type Literal
{ errorMessage?: string; errorReason: | "invalid_exact_canton_missing_proof" | "invalid_exact_canton_malformed_payload" | "invalid_exact_canton_signature_invalid" | "invalid_exact_canton_amount_mismatch" | "invalid_exact_canton_merchant_mismatch" | "invalid_exact_canton_instrument_id_mismatch" | "invalid_exact_canton_preapproval_missing" | "invalid_exact_canton_fee_payer_mismatch" | "invalid_exact_canton_expired" | "invalid_exact_canton_execute_before_too_far" | "invalid_exact_canton_insufficient_inputs" | "invalid_exact_canton_memo_mismatch" | "invalid_exact_canton_merchant_not_registered" | "invalid_exact_canton_self_payment" | "invalid_exact_canton_execute_failed" | "unexpected_canton_ledger_error" | "settlement_pending" | "invalid_network" | "unsupported_scheme" | "insufficient_funds" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "unexpected_verify_error" | "unexpected_settle_error" | "invalid_exact_canton_synchronizer_mismatch"; extensions?: { [key: string]: unknown; }; network: string; payer?: string; success: false; transaction: string; }
errorMessage?
string = ...
Human-readable text for errorReason. Free text that can change between facilitators, so match on the code, never on this (x402 v2 §9). Which of a code's causes it was goes in extensions.detail, as on verify.
errorReason
| "invalid_exact_canton_missing_proof" | "invalid_exact_canton_malformed_payload" | "invalid_exact_canton_signature_invalid" | "invalid_exact_canton_amount_mismatch" | "invalid_exact_canton_merchant_mismatch" | "invalid_exact_canton_instrument_id_mismatch" | "invalid_exact_canton_preapproval_missing" | "invalid_exact_canton_fee_payer_mismatch" | "invalid_exact_canton_expired" | "invalid_exact_canton_execute_before_too_far" | "invalid_exact_canton_insufficient_inputs" | "invalid_exact_canton_memo_mismatch" | "invalid_exact_canton_merchant_not_registered" | "invalid_exact_canton_self_payment" | "invalid_exact_canton_execute_failed" | "unexpected_canton_ledger_error" | "settlement_pending" | "invalid_network" | "unsupported_scheme" | "insufficient_funds" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "unexpected_verify_error" | "unexpected_settle_error" | "invalid_exact_canton_synchronizer_mismatch" = SettleErrorReasonSchema
extensions?
{ [key: string]: unknown; } = ...
network
string = ...
payer?
string = ...
success
false = ...
transaction
string = ...
The transaction the answer is about. Empty when nothing was relayed. On settlement_pending it is the payment's preparedTxHash: the relay went out and its outcome is not known yet.
Returns
response is { errorMessage?: string; errorReason: "invalid_exact_canton_missing_proof" | "invalid_exact_canton_malformed_payload" | "invalid_exact_canton_signature_invalid" | "invalid_exact_canton_amount_mismatch" | "invalid_exact_canton_merchant_mismatch" | "invalid_exact_canton_instrument_id_mismatch" | "invalid_exact_canton_preapproval_missing" | "invalid_exact_canton_fee_payer_mismatch" | "invalid_exact_canton_expired" | "invalid_exact_canton_execute_before_too_far" | "invalid_exact_canton_insufficient_inputs" | "invalid_exact_canton_memo_mismatch" | "invalid_exact_canton_merchant_not_registered" | "invalid_exact_canton_self_payment" | "invalid_exact_canton_execute_failed" | "unexpected_canton_ledger_error" | "settlement_pending" | "invalid_network" | "unsupported_scheme" | "insufficient_funds" | "invalid_payload" | "invalid_payment_requirements" | "invalid_scheme" | "invalid_x402_version" | "invalid_transaction_state" | "unexpected_verify_error" | "unexpected_settle_error" | "invalid_exact_canton_synchronizer_mismatch"; extensions?: { [key: string]: unknown }; network: string; payer?: string; success: false; transaction: string } & { errorReason: "settlement_pending" }