Guides
React signup component
Render your published signup flow with <TiltSignup /> from @tilt-pay/react, through routes you host.
@tilt-pay/react provides <TiltSignup />, which renders the signup flow published in the Hub: modules, order, required fields, labels and terms links. It comes from the same private registry as the SDK.
npm install @tilt-pay/react@next @tilt-pay/sdk@nextYour key stays on your server#
The component never calls the Tilt Pay API and takes no API key. It calls routes that you host, which hold the key and use @tilt-pay/sdk:
browser: <TiltSignup baseUrl="/api/tilt" /> -> your routes (createSignupProxy) -> Tilt Pay APIimport { TiltSignup } from '@tilt-pay/react'
import '@tilt-pay/react/styles.css'
export function Signup() {
return <TiltSignup baseUrl="/api/tilt" locale="en" onComplete={({ response }) => console.log(response)} />
}The proxy routes#
Route (relative to baseUrl) | Request | Success response |
|---|---|---|
GET /signup-config | body of GET /v1/signup-config | |
POST /phone/send-code | { "phone" } | { "retry_after_seconds"?: number } |
POST /phone/verify-code | { "phone", "code" } | { "verification_token"?: string } |
POST /users | { "values", "verification_token"? } and the header Idempotency-Key | your own result |
Errors use the API envelope { "error": { "code", "message", "param"?, "request_id"? } } with a non-2xx status.
A ready-to-copy implementation, createSignupProxy, ships in the SDK repository under examples/signup-proxy/, with an Express adapter and a Next.js route handler. Your backend must not trust the browser about phone verification: the example signs a short-lived token once the code is approved and requires it to create the account.
Customising#
themeandcolorSchemefor your colors, or style thetp-*class names yourself.messagesandlocalefor the texts (built-in dictionaries:en,fr).configto pass a flow you already fetched on your server.onCompleteandonErrorto follow the outcome.
The package README documents every prop.