Skip to content

Payment Retry Wizard for Failed Transactions #432

Description

@Kingsman-99

Description

When a Stellar payment transaction fails (insufficient fee, sequence number mismatch, destination account not found, etc.), the user currently receives only a raw error code with no actionable guidance. This issue builds a payment retry wizard that intercepts failed transaction submissions, parses the Stellar error code into a human-readable explanation, suggests the appropriate corrective action (bump fee, refresh sequence number, activate destination account), and guides the user through corrected re-submission step by step.

Technical Context

Create lib/stellarErrorParser.ts mapping Stellar result_codes (e.g., tx_insufficient_fee, op_no_destination, tx_bad_seq, op_underfunded) to { title, explanation, suggestedAction, actionType: 'bump-fee'|'refresh-seq'|'fund-destination'|'manual' }. Build components/invoice/PaymentRetryWizard.tsx as a modal triggered when usePaymentSubmission receives a submission error. The wizard shows: step 1 (error explanation), step 2 (corrective action UI including bump fee slider, refresh seq button, or fund-destination link), step 3 (re-build and re-sign transaction with correction applied). Re-building uses TransactionBuilder with fresh loadAccount data for the correct sequence number. Log all retry attempts to the invoice audit trail. Limit automatic retries to 3 before surfacing a manual fallback.

Acceptance Criteria

  • A tx_insufficient_fee error surfaces a wizard step with a fee-bump slider pre-set to the median fee from feeStats, and submitting the wizard creates a fee-bump transaction
  • A tx_bad_seq error surfaces a "Refresh Sequence Number" button; clicking it calls loadAccount to get the current sequence number and rebuilds the transaction
  • An op_no_destination error explains that the destination account is not yet funded and provides a link to fund it on the testnet Friendbot (or a mainnet guide)
  • All retry attempts are logged in the invoice audit trail with the error code, corrective action taken, and outcome
  • After 3 consecutive failed retries the wizard presents a "Contact support" link and disables further automatic retry
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions