API reference

Plondo Foundation API

A small REST API for donations, contact, and status. Base URL https://plondofoundation.org. All responses are JSON; all errors use { "error", "code", "message" }. Full machine-readable spec at /openapi.json.

GET/api/health

Service status. No auth.

curl https://plondofoundation.org/api/health

{ "ok": true, "stripe": true, "database": true, "twilio": true, "smtp": true }

GET/api/public-config

Browser-safe configuration. Returns the referrer-restricted Google Maps key used by client-side address autocomplete.

{ "googleMapsApiKey": "..." }

POST/api/create-payment-intent

Create a one-time or recurring monthly donation. Card details are tokenized in the browser with Stripe.js; the server only receives a Stripe paymentMethodId. Amounts are capped at $10,000 (1,000,000 cents).

Request body

{
  "amount": 5000,                 // integer cents (50–1000000)
  "type": "One-time",             // or "Monthly"
  "paymentMethodId": "pm_...",    // from stripe.createPaymentMethod
  "email": "[email protected]",
  "firstName": "Ada",
  "lastName": "Lovelace",
  "company": "",                  // optional
  "phone": "",                    // optional
  "address": "", "city": "", "state": "",
  "postalCode": "", "country": "US"
}

Response

{ "clientSecret": "pi_..._secret_...",
  "paymentIntentId": "pi_...",     // one-time
  "subscriptionId": "sub_...",     // monthly
  "amount": 5000, "currency": "usd", "type": "One-time" }

Then confirm client-side: stripe.confirmCardPayment(clientSecret).

curl -X POST https://plondofoundation.org/api/create-payment-intent \
  -H "Content-Type: application/json" \
  -d '{"amount":5000,"type":"One-time","paymentMethodId":"pm_123","email":"[email protected]","firstName":"Ada","lastName":"Lovelace"}'

POST/api/contact

Send the Foundation a message. Protected by rate limiting and a honeypot field.

curl -X POST https://plondofoundation.org/api/contact \
  -H "Content-Type: application/json" \
  -d '{"name":"Ada","email":"[email protected]","subject":"Hello","message":"..."}'

{ "ok": true }

Errors

All endpoints return structured JSON errors with an HTTP status that matches:

{ "error": "Invalid amount", "code": "bad_request", "message": "..." }

Command-line tool

An official CLI wraps this API — plondo-foundation-cli on npm:

npx plondo-foundation-cli health   # check API status
npx plondo-foundation-cli docs     # print developer/docs URLs

Or run it straight from the source repository:

node cli/plondo.js health

OpenAPI spec   Back to developer portal