The Terra API and SDKs are in early access. Code on this page is a Preview API, subject to change.
View as MarkdownDevelopers
Early accessFrom zero to a verified payment in five minutes
Install the SDK, add a Connect button, create a payment on your server and verify the signed webhook. Connecting to Terra Wallet already works today through open standards.
Quick start
Four steps to your first payment
1. Get sandbox keys
Sign in to the dashboard and copy a publishable key (
tw_test_pk_...) for the browser and a secret key (tw_test_sk_...) for your server. Secret keys are shown once.2. Install
Add the React and server packages. Package names may change before launch.
3. Connect and pay
Wrap your app in
TerraProvider, drop in<ConnectButton/>, and create payments on your server with an idempotency key.4. Verify webhooks
Check the HMAC-SHA256 signature and timestamp on every event, then read the payment's current state from the API.
# Preview: package names may change before launch.npm install @terrawallet/react @terrawallet/serverWebhooks
Verify every webhook signature
Each event is signed with HMAC-SHA256 over a timestamp and the raw body. Reject old timestamps, compare in constant time, and treat events as hints: the API holds the current state.
- Deliveries may repeat or arrive out of order. Every event has a unique id, so handle each one once.
- Retries with backoff, a delivery log and one-click replay in the dashboard.
- Webhook addresses must be https and public: private, loopback, link-local and metadata addresses are refused on every delivery.
verify.js
// Preview API, subject to change: verify a Terra webhook in Node.js.import { createHmac, timingSafeEqual } from "node:crypto"; // Header example: Terra-Signature: t=1763884800,v1=5f2b...export function verifyTerraWebhook(rawBody, header, secret) { const parts = Object.fromEntries(header.split(",").map((p) => p.split("="))); const t = Number(parts.t); // Reject anything outside a 5 minute window (replay protection). if (!t || Math.abs(Date.now() / 1000 - t) > 300) return false; const expected = createHmac("sha256", secret) .update(`${t}.${rawBody}`) .digest(); const given = Buffer.from(String(parts.v1 ?? ""), "hex"); return given.length === expected.length && timingSafeEqual(given, expected);} // Then: look up the payment with the API for its current state,// and treat repeated or out-of-order events as normal.API
An API that's predictable for people and AI
Versioned and typed
Versioned
/v1paths, an OpenAPI 3.1 spec and typed clients generated from it.Helpful errors
Every error carries a stable
code, adoc_urland a fix hint, plus a request id.Safe retries
An
Idempotency-Keyon every create, so a retry never charges twice.Strict by default
Schemas reject unknown fields. Cursor pagination with hard limits, and rate-limit headers on every response.
Works today
Connect to Terra Wallet right now
You don't have to wait for the SDK to support Terra Wallet users: it speaks WalletConnect v2, EIP-1193, EIP-6963 and the Solana Wallet Standard today. See Terra Connect for working code, and Build with AI to work with your assistant.
FAQ
Frequently asked questions
Can I use the API today?
Not yet. The API and SDKs are in early access, and the code here is a Preview API, subject to change. Terra Connect works today through open standards.
How do I get API keys?
From the dashboard at launch: a publishable key (tw_test_pk_) for the browser and a secret key (tw_test_sk_) for your server. Secret keys are shown once and stored only as a hash.
How are webhooks signed?
With HMAC-SHA256 over a timestamp and the raw body. Reject old timestamps, compare in constant time, and read the current state from the API.
Will retries create duplicate payments?
No. Send an Idempotency-Key with every create, and a retry returns the original result.
Is there a sandbox?
Yes. Test mode runs on testnets, with a simulated payment option and test webhooks.
Early access
Early accessRequest early access
Tell us what you're building. Early partners get sandbox access first and help shape what ships.
- Early partners get sandbox access first and help shape the product.
- We email you when the product you picked opens. No newsletters you didn't ask for.
- Pricing will be shared at launch. Talk to us through this form.