Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/alfonsoolavarria/florilegio/llms.txt

Use this file to discover all available pages before exploring further.

Florilegio de la Fe uses PayPal’s JavaScript SDK to handle subscription checkout. The flow is client-driven: the PayPal JS SDK collects payment and, upon approval, hands back a subscription_id. Your frontend then calls this endpoint to record the activated plan on the authenticated user’s UserProfile. The server updates the plan field and returns confirmation — no further redirect or webhook is required to unlock the upgraded limits.

POST /api/paypal/subscription/activate/

Activates a premium or pro subscription plan for the currently authenticated user. Authentication: Login required (@login_required) Rate limit: 10 requests / hour per user_or_ip Method: POST — JSON body, CSRF token required

Request body

subscription_id
string
required
The PayPal subscription ID returned by the PayPal JS SDK upon the user’s approval. Example: "I-1234567890AB". This value is stored on the user’s profile as confirmation of the activated subscription.
plan
string
required
The plan to activate. Must be exactly "premium" or "pro". Any other value, or an empty/missing field, returns HTTP 400.

Responses

Success — HTTP 200
{
  "status": "success",
  "plan": "premium",
  "subscription_id": "I-1234567890AB"
}
Invalid request — HTTP 400 Returned when subscription_id is missing or plan is not "premium" or "pro".
{
  "status": "error",
  "message": "Datos inválidos."
}
The server does not verify the subscription_id with PayPal’s API — it trusts the value provided by the client. This endpoint is protected by @login_required and rate-limited, but you should implement additional server-side verification (e.g. calling the PayPal Subscriptions REST API to confirm the subscription is ACTIVE) before deploying to a production environment where billing integrity is critical.

Plan effects

PlanStudy note limitDescription
premium100Up to 100 personal Bible study notes
proUnlimitedNo cap on study notes

PayPal SDK configuration

The PayPal JS SDK embedded in the plans page (GET /planes/) is initialized using the following environment variables:
VariablePurpose
PAYPAL_CLIENT_IDPayPal application client ID for the JS SDK
PAYPAL_PLAN_PREMIUMPayPal billing plan ID for the premium tier
PAYPAL_PLAN_PROPayPal billing plan ID for the pro tier
These values are injected into the template context by the planes view and must be set in the server environment before the subscription flow can be used.

Example

curl -X POST https://florilegiodelafe.com/api/paypal/subscription/activate/ \
  -H "Content-Type: application/json" \
  -H "X-CSRFToken: <csrf_token>" \
  --cookie "sessionid=<session_cookie>" \
  -d '{"subscription_id": "I-1234567890AB", "plan": "premium"}'

Build docs developers (and LLMs) love