Developer API

Webhook API

Push transaction data into LAYA Finance in real time from any external service — Maya, GCash, UnionBank, Wise, PayPal, Zapier automations, and more. All requests hit a single base URL and are secured with a per-user bearer token.

Base URL

url
https://webhook.laya.finance/api/

Authentication

All endpoints (except /paypal.php) require a bearer token and a JSON content-type header. Your personal token is available in LAYA Finance under Settings → Integrations.

Bearer Token

A static per-user secret issued from within the LAYA Finance app. Keep it private — treat it like a password.

PayPal Exception

The /paypal.php endpoint does not use a bearer token. It validates requests using PayPal's own webhook signature verification.

http headers
Authorization: Bearer <your_token>
Content-Type: application/json

Endpoints

POST/transaction.php

Ingest a transaction from any external source. Used by Zapier automations, Maya forwarding, GCash email parsing, and direct API integrations.

Request Body

json
{
  "source":         "maya",          // maya | gcash | unionbank | wise | paypal | marbank_email
  "external_id":    "TXN-20260314",  // unique ID from the source system (deduplication)
  "amount":         1500.00,
  "currency":       "PHP",           // ISO 4217 currency code
  "type":           "expense",       // income | expense | transfer
  "category":       "Food",          // any TransactionCategory string
  "merchant":       "Jollibee",
  "notes":          "Lunch with team",
  "transaction_at": "2026-03-14T12:00:00Z"
}

Response

json
{ "success": true, "id": "uuid-of-created-transaction" }
Deduplication: If external_id already exists for the same source, the request is accepted (200) but no duplicate record is created.
POST/register_token.php

Register an iOS APNs device token so the server can push remote notifications to the user's device. Called automatically by the LAYA iOS app on launch.

Request Body

json
{
  "token":    "abc123def456...",  // APNs device token (hex string)
  "platform": "ios",
  "bundleId": "finance.laya.app"
}

Response

json
{ "success": true, "registered": true }
POST/paypal.phpNo bearer token

PayPal webhook handler. Requests are authenticated using PayPal's own signature verification — do not include an Authorization header. Register this URL in your PayPal Developer Dashboard.

Supported Events

  • PAYMENT.SALE.COMPLETED
  • PAYMENT.CAPTURE.COMPLETED
  • INVOICING.INVOICE.PAID
  • MONEY.TRANSFER.COMPLETED
POST/apple_signin.php

Validate a Sign in with Apple identity token server-side and return a LAYA session. Called by the iOS and macOS apps during the Apple Sign-In flow.

Request Body

json
{
  "identity_token":   "eyJraWQiOi...",  // JWT from ASAuthorizationAppleIDCredential
  "user_identifier":  "001234.abc...",  // Apple user sub
  "full_name":        "Juan dela Cruz",  // optional, only provided on first sign-in
  "email":            "[email protected]"
}

Response

json
{
  "success": true,
  "user_id": "laya-uuid",
  "token":   "bearer-session-token"
}
GET/health.phpPublic

Health check endpoint. Returns server status, database connectivity, and APNs key availability. No authentication required.

Response

json
{
  "success":    true,
  "status":     "ok",
  "db":         "connected",
  "apns_key":   "present",
  "timestamp":  "2026-03-14T12:00:00Z"
}

Zapier Integration

Connect any service to LAYA Finance in minutes using Webhooks by Zapier — no custom code needed. Whenever a Zap fires (e.g. a new Gmail email matching "You sent ₱"), Zapier can POST the transaction directly into LAYA.

1
Choose your trigger
Any Zapier trigger — Gmail filter, Google Sheets row, Notion entry, SMS parser, etc.
2
Add "Webhooks by Zapier" action
In the action step, select Webhooks by Zapier → POST.
3
Configure the request
Set the URL, headers, and body as shown below. Map Zapier fields to the transaction fields.
4
Test and activate
Send a test transaction. Verify it appears in LAYA, then activate the Zap.

Zapier Webhook Configuration

zapier config
Method:   POST
URL:      https://webhook.laya.finance/api/transaction.php

Headers:
  Authorization:  Bearer <your_token>
  Content-Type:   application/json

Body (map from your trigger fields):
  source:         "zapier"
  external_id:    {{trigger.id}}
  amount:         {{trigger.amount}}
  currency:       "PHP"
  type:           "expense"
  category:       {{trigger.category}}
  merchant:       {{trigger.merchant}}
  notes:          {{trigger.notes}}
  transaction_at: {{trigger.timestamp}}

Example: cURL

A working example posting a single expense transaction:

bash
curl -X POST https://webhook.laya.finance/api/transaction.php \
  -H "Authorization: Bearer YOUR_TOKEN_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "source":         "gcash",
    "external_id":    "GCASH-20260314-001",
    "amount":         350.00,
    "currency":       "PHP",
    "type":           "expense",
    "category":       "Food",
    "merchant":       "Mang Inasal",
    "notes":          "Lunch",
    "transaction_at": "2026-03-14T12:30:00Z"
  }'

Response Format

All endpoints return JSON. Successful responses include "success": true and any relevant data. Errors include "success": false and a human-readable "error" string.

Success (HTTP 200)

json
{
  "success": true,
  "id": "uuid",
  ...
}

Error (HTTP 4xx / 5xx)

json
{
  "success": false,
  "error": "Missing required field: amount"
}

HTTP Status Codes

200OKRequest succeeded (or duplicate was silently ignored).
400Bad RequestMissing or invalid fields in the request body.
401UnauthorizedMissing, malformed, or invalid bearer token.
409ConflictDuplicate external_id (also returns 200 in some endpoints — check the response body).
500Server ErrorInternal error — check /health.php and contact support.

Questions or Issues?