Skip to content

feat(payments): include sol_price_usd in GET /payments/:id#2

Open
relayhop wants to merge 1 commit into
Cypher-CP0:mainfrom
relayhop:feat/sol-price-in-get
Open

feat(payments): include sol_price_usd in GET /payments/:id#2
relayhop wants to merge 1 commit into
Cypher-CP0:mainfrom
relayhop:feat/sol-price-in-get

Conversation

@relayhop
Copy link
Copy Markdown

@relayhop relayhop commented May 3, 2026

Closes #1 (backend portion).

Problem

The widget polls GET /api/payments/:id for status, but sol_price_usd is only returned by POST /api/payments/create. So the widget has to make a separate GET /api/price/sol call to read the price — an extra roundtrip plus a price that may not match what the backend computed at payment creation time.

Change

Include sol_price_usd: await getSolPrice() in the GET response, mirroring what create already returns. Cache (30s) prevents this from hammering the price API.

Result

The widget can read payment.sol_price_usd directly (matching the issue Expected behavior: Read sol_price_usd from the payment object returned by the backend).

A matching widget PR (read from payment object instead of /api/price/sol) will follow on Cypher-CP0/fluxpay-widget.

The widget polls GET /payments/:id for status; previously sol_price_usd
was only returned on creation, so the widget had to make a separate
/api/price/sol call. Including it here lets the widget read the price
directly from the payment object (matching the issue's expected behavior),
saving one HTTP roundtrip per checkout.

Refs Cypher-CP0#1
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.

feat: replace hardcoded SOL price with live price feed from backend

1 participant