What The Business API Is For
Business API keys connect one external website to one LifeRP Central business wallet. A shop, loan site, job panel, or service website can send players to LifeRP Central to approve payments, then use server-side events to confirm that money arrived. External websites should call LifeRP Central backend routes only. They should never call Supabase directly.
- Hosted payments for player-approved money movement.
- Business events for payment confirmation.
- Direct payment API for trusted backend systems.
- Token regeneration when a key is no longer trusted.
Create And Protect API Keys
Open your business console, go to API Keys, and create or regenerate a key. LifeRP Central shows the raw tok_live_... value once and stores only the hash. Put the token in your external site server environment variables.
- Never put a business token in frontend JavaScript.
- Never send a business token to a player browser.
- Use Authorization: Bearer tok_live_... from your backend only.
- Regenerate the key if a staff member leaves or the token leaks.
- After regeneration, old active tokens for that business stop working.
Recommended Flow: Hosted Payment
Hosted payment is the safest normal purchase flow. Your site redirects the player to LifeRP Central. LifeRP Central shows the business, amount, and memo. The player approves while logged in, LifeRP Central applies business tax, credits the business wallet, creates logs, creates an event, and returns the player to your site.
const liferpUrl = "https://liferp.ninioteam.dev";
const paymentUrl = new URL("/businesses/pay", liferpUrl);
paymentUrl.searchParams.set("business_id", "BUSINESS_UUID");
paymentUrl.searchParams.set("amount", "250");
paymentUrl.searchParams.set("memo", "Order #123");
paymentUrl.searchParams.set("return_url", "https://your-site.example/liferp/return");
return Response.redirect(paymentUrl.toString());Confirm Payments With Events
Do not trust the return URL alone. Users can refresh pages, close tabs, or manually open URLs. Your backend should poll LifeRP Central events and process each event ID once.
const response = await fetch(`https://liferp.ninioteam.dev/api/businesses/events`, {
headers: {
Authorization: `Bearer <API Token>`
}
});
const payload = await response.json();{
"ok": true,
"events": [
{
"id": "event_uuid",
"event_type": "business_payment_received",
"payer_steam_id": "76561199193430225",
"amount": 225,
"bank_transaction_id": "transaction_uuid",
"payload": {
"memo": "Order #123",
"gross_amount": 250,
"tax_amount": 25,
"net_amount": 225
}
}
]
}Direct Business Payment API
Direct payments are for trusted backend systems only. Use this when your server already has a valid reason to create a LifeRP Central business payment record. For normal user purchases, hosted payment is preferred because the player approves it on LifeRP Central.
const response = await fetch(`https://liferp.ninioteam.dev/api/businesses/payment`, {
method: "POST",
headers: {
Authorization: `Bearer <API Token>`,
"Content-Type": "application/json"
},
body: JSON.stringify({
payer_steam_id: "76561199193430225",
amount: 250,
memo: "Invoice #123",
instant: false
})
});
const payment = await response.json();Business Tax And Wallet Result
Business income is taxed before the business wallet receives money. Event payloads include the original gross amount, tax amount, net amount credited to the business wallet, and whether the business was tax exempt. Only the configured LifeRP owner account can mark a business as tax exempt.
$0-$10,000: 10%
$10,001-$100,000: 0.5%
$100,001 and above: 0.1%Regenerate Or Revoke Tokens
Regenerate a token when it was copied into the wrong place, a staff member leaves, a website host changes, or you are moving to production. Regeneration returns one new raw token and disables old active tokens for the business.
- Copy the new token once.
- Update the external site's environment variable.
- Redeploy or restart the external site.
- Poll events again to confirm the new token works.
Common API Errors
401: missing, invalid, revoked, or regenerated token
403: business or account is restricted
404: business, payment, or event target not found
400: invalid amount, memo, JSON, or required field- Store your own order ID in memo.
- Save processed LifeRP Central event IDs.
- Use hosted payment for player approval.
- Use direct payment only from trusted backend code.
Quick Production Checklist
- Business API key is stored only on the server.
- External site confirms payments through events.
- Return URL is treated as navigation, not proof.
- Token regeneration process is understood by business staff.
- External site logs LifeRP Central event IDs and order IDs.
Build with hosted payments first, then add direct API calls only when your backend needs them.