Docs

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.

Shell
npm install @tilt-pay/react@next @tilt-pay/sdk@next

Your 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:

Text
browser: <TiltSignup baseUrl="/api/tilt" />  ->  your routes (createSignupProxy)  ->  Tilt Pay API
jsx
import { 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)RequestSuccess response
GET /signup-configbody 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-Keyyour 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#

  • theme and colorScheme for your colors, or style the tp-* class names yourself.
  • messages and locale for the texts (built-in dictionaries: en, fr).
  • config to pass a flow you already fetched on your server.
  • onComplete and onError to follow the outcome.

The package README documents every prop.