Stellar Testnet is available in sandbox. Stellar mainnet is available in beta for enabled production environments.
Configure your backend
Create an API key in Ground Portal → API Keys. Copy it when shown and store it in your backend’s secret manager asGROUND_API_TOKEN. Never expose an API key in browser or mobile code. The
examples use sandbox:
https://production.groundtech.co, a production API key, and stellar as the chain key.
1. Create a wallet for the customer
Create one Portfolio Wallet for each customer. Store the Ground wallet ID on the customer record in your database.your-usdc-yield-source-id with the USDC yield source configured for
your integration. Save the requestId before sending the request. If the
request times out, retry it with the same ID.
Wallet creation is asynchronous. Subscribe to
portfolio_wallet.status_changed before creating the wallet. Store the returned
wallet ID, then wait for its status to become idle. If a webhook is delayed or
missed, reconcile the state with GET /v2/wallets/{id}. Treat failed as a
provisioning failure.
Stellar will not appear in depositAddresses yet. Enable it separately after
the wallet is ready.
2. Enable Stellar deposits
Configure approval signing
Configure an approval signer once for each Ground organization and environment before enabling Stellar deposits. The platform controls this signer and uses it to authorize the Stellar deposit setup. For a server-side integration, configure a machine signer so your backend can verify and approve activities automatically:- Open Ground Portal → Settings → Signing and enable approval signing.
- Create and register a machine signing key.
- Store the private key in your backend’s secret manager. Never send it to Ground or expose it in client code.
- When Ground creates an approval, verify the wallet, network, and activity details before stamping and submitting the vote from your signing service.
409 with
stellar_customer_approval_unavailable. Ground does not create a Stellar setup
or approval activity.
Subscribe to approval events
Subscribe toportfolio_wallet.approval.status_changed before enabling Stellar
deposits so your application receives the approval created by the request. See
Webhooks.
Verify the webhook signature before parsing it and deduplicate deliveries using
the Ground-Event-Id header.
Request Stellar setup
After the webhook subscription is active, call the enable endpoint from your backend for the customer’s saved wallet ID:Approve the Stellar deposit setup
The platform backend requests the Turnkey approval payload, verifies the activity, stamps it with the organization signer, and submits the vote:stellar_trustline activity kind, and Stellar network. See
Transaction Approvals for
the complete verification flow. Continue after
portfolio_wallet.approval.status_changed reports approved.
If the approval is rejected or expires, call the enable endpoint again. Ping
Ground if the error persists.
After the approval succeeds, the Stellar deposit address appears in
GET /v2/wallets/{id} under depositAddresses[stellarChain]. It may take a
short time to appear. Once available, save the address and show it to the
customer.
3. Receive USDC and start earning
Use the Stellar deposit address to fund the customer’s Portfolio Wallet with USDC. Subscribe toportfolio_wallet.deposit.status_changed. After a deposit becomes
completed, refresh the wallet and update the customer-facing balance.
4. Display balances and earnings
Use the customer’s wallet ID to fetch their current balance and yield details:
Dollar values are returned as decimal strings. Refresh the wallet after deposit
and withdrawal updates. You can also refresh it periodically while the customer
is viewing their portfolio.
5. Withdraw USDC to Stellar
First, preview the USDC withdrawal amount and Stellar destination chain. If the preview looks correct, create the withdrawal with the customer’s destination address and a newrequestId. Save the returned withdrawal ID in your database.
portfolio_wallet.withdrawal.status_changed and track the
withdrawal until it is completed or failed. A cross-chain withdrawal may
require multiple approvals. Match each approval to the saved withdrawal, verify
its details, and sign it with the organization signer. An approval does not mean
the withdrawal is complete.