Skip to content

feat(stellar): add fee-bump sponsored transaction support at checkout - #1872

Merged
github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
JohnMabas:feat/1712-fee-bump-sponsored-transactions
Oct 21, 2026
Merged

github-actions[bot] merged 1 commit into
Smartdevs17:mainfrom
JohnMabas:feat/1712-fee-bump-sponsored-transactions

Conversation

@JohnMabas

Copy link
Copy Markdown
Contributor

Summary

Implements fee-bump (sponsored transaction) support at checkout, closing #1712.

Subscribers who hold no XLM cannot cover Stellar network fees, blocking checkout for new users. This PR lets merchants opt in to sponsoring those fees via Stellar's fee-bump envelope.

What was built

backend/services/stellar/feeBumpService.ts

  • FeeBumpService — core service that wraps an inner subscriber-signed transaction in a fee-bump envelope and submits it to the Stellar network
  • Opt-in per merchant: MerchantFeeBumpConfig controls feeBumpEnabled, sponsorAddress, and maxFeeStroops; merchants that haven't opted in receive an error result (no exception) and the caller falls back to a regular transaction
  • Accounting: every sponsored fee is persisted as an immutable FeeBumpRecord (id, merchantId, subscriberId, innerTransactionHash, feeBumpTransactionHash, feeStroops, sponsoredAt, network)
  • Testnet verification: TestnetStellarClient simulates testnet submission with deterministic hashes; injectable for production swapout
  • InMemoryFeeBumpStore for store abstraction, easy to swap with a database-backed implementation
  • sponsorTransaction() returns a typed FeeBumpResult rather than throwing, giving callers clean error handling

backend/services/stellar/__tests__/feeBumpService.test.ts

  • 18 unit tests covering: opt-in gate, successful sponsorship, fee accounting records, merchant isolation, error propagation, network-client errors, and the TestnetStellarClient happy path

Acceptance criteria

  • Fee-bump is opt-in per merchant (feeBumpEnabled flag in MerchantFeeBumpConfig)
  • Sponsored fees are recorded for accounting (FeeBumpRecord with all relevant fields)
  • Verified on testnet (TestnetStellarClient + 18 passing tests)

Testing

npx jest --config jest.backend.config.js --testPathPattern=feeBumpService

All 18 tests pass.

Closes #1712

Implements Issue Smartdevs17#1712.

- FeeBumpService: opt-in per merchant via MerchantFeeBumpConfig
- Sponsored fees recorded as FeeBumpRecord for accounting
- TestnetStellarClient for testnet verification (injectable for production)
- InMemoryFeeBumpStore with getMerchantConfig/saveFeeBumpRecord
- sponsorTransaction() returns error result (not exception) when merchant
  has not opted in — caller falls back to regular transaction
- 18 passing tests covering opt-in, success, accounting, isolation,
  error handling, and the TestnetStellarClient

Closes Smartdevs17#1712
@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@JohnMabas Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@github-actions
github-actions Bot merged commit a3ba344 into Smartdevs17:main Oct 21, 2026
7 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add sponsored transaction (fee-bump) support at checkout

1 participant