Skip to main content

Prerequisites

  • Payward Services API credentials (see the Authentication guide).
  • A verified user with at least one account and on-chain quote trading enabled.
  • A source wallet registered on the user’s withdrawal-address list as a same-owner address. The address must be approved before you create a quote.
  • Enough source-asset balance in the wallet to settle the on-chain quote.

Workflow

1

Create an on-chain quote

Create a wallet-funded xStocks on-chain quote and receive the on-chain payload.POST /v1/accounts/{account_id}/onchain-quotes
2

Submit the on-chain transaction

Call the Payward on-chain proxy contract with the returned payload before expires_at.executeSwap(...)
3

Poll for terminal status

Wait for Payward Services to observe settlement, or subscribe to webhooks.GET /v1/accounts/{account_id}/onchain-quotes/{quote_id}

Quote lifecycle

Specifying the trade

Onchain quotes are restricted to xStock and USDC pairs. Set the wallet block on from — the quote is funded from the user’s wallet, not from the user’s Payward Services account balance. The only supported network value is ethereum.

Authentication setup

Authenticated endpoints require an HMAC-SHA512 request signature in the API-Sign header and a monotonically increasing nonce in the API-Nonce header. The helper below derives the signature from the URL path, request body, and nonce. See the Authentication guide for the full algorithm.

Step 1: create an on-chain quote

Send a POST to /v1/accounts/{account_id}/onchain-quotes with from.wallet populated. The create response returns the full quote including execution_details, which carries the proxy contract address and the signed on-chain payload.
Store execution_details from the create response. GET /v1/accounts/{account_id}/onchain-quotes/{quote_id} returns quote status and amounts, but it does not return a fresh on-chain execution payload.

Step 2: submit the on-chain transaction

Call executeSwap on execution_details.proxy_address. Pass the returned proxy_swap_message before the quote expires. The proxy call uses this argument shape:
Typescript
If you do not pass an input-token permit, approve the proxy to spend the source token from the user’s wallet before you broadcast the transaction.
Onchain quote settlement happens on-chain. There is no server-side execute endpoint — the proxy contract call is the only way to fulfil an on-chain quote offer.

Step 3: poll for terminal status

After broadcasting on-chain, poll GET /v1/accounts/{account_id}/onchain-quotes/{quote_id} until status reaches a terminal value (executed, expired, or failed).
Subscribe to the quote.executed and quote.execution_failed webhooks if you do not want to poll.

Reviewing on-chain quotes

List previously created on-chain quotes with GET /v1/accounts/{account_id}/onchain-quotes. Results are returned newest-first. Use page_token and page_size (defaults to 50, max 200) for pagination — next_page_token is omitted on the final page.
History entries omit execution_details. The signed on-chain payload is only returned by the create response.

Error handling

Best practices

  1. Register wallets ahead of time. Screening can take time and will block quote creation until the address is approved.
  2. Store the on-chain quote create response. It is the only response that includes the signed on-chain execution payload.
  3. Treat executed, expired, and failed as terminal. Request a new quote for another attempt.
  4. Submit on-chain well before expires_at. Gas spikes and confirmation time reduce the usable window.
  5. Capture Request-Id from response headers. It speeds up support investigations.

API reference