Skip to main content

Documentation Index

Fetch the complete documentation index at: https://api.docs.onlydrams.app/llms.txt

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

URL Parameters

community_id
uuid
required
The ID of the community
id
integer
required
The ID of the membership tier to subscribe to

Returns

Returns the credentials needed to initialize the Stripe PaymentSheet SDK on iOS and Android.
curl -X POST https://api.onlydrams.app/api/v1/communities/abc-123/tiers/1/payment_sheet \
     -H "Authorization: Bearer $ACCESS_TOKEN"
{
  "payment_intent": "pi_3abc123_secret_xyz789",
  "customer_session_client_secret": "cuss_abc123xyz",
  "customer": "cus_abc123",
  "ephemeral_key": "ek_test_abc123xyz",
  "publishable_key": "pk_test_abc123",
  "subscription_id": "sub_abc123",
  "tier": {
    "id": 1,
    "name": "Premium Membership",
    "price_cents": 999,
    "currency": "usd",
    "has_trial": true,
    "trial_days": 7
  }
}

Response Fields

FieldTypeDescription
payment_intentstringThe client secret for the PaymentIntent or SetupIntent. Use this to initialize PaymentSheet.
customer_session_client_secretstringThe CustomerSession client secret for PaymentSheet configuration.
customerstringThe Stripe Customer ID on the connected account.
ephemeral_keystringThe ephemeral key secret for the customer.
publishable_keystringThe Stripe publishable key to use.
subscription_idstringThe ID of the created subscription (status will be incomplete until payment succeeds).
tier.idintegerThe membership tier ID.
tier.namestringThe tier display name.
tier.price_centsintegerThe monthly price in cents.
tier.currencystringThe currency code (e.g., usd).
tier.has_trialbooleanWhether this tier includes a free trial.
tier.trial_daysintegerNumber of free trial days (null if no trial).

Error Responses

StatusErrorDescription
422Community does not have a connected Stripe accountThe community hasn’t completed Stripe onboarding.
422This tier is not available for subscriptionThe tier is archived or inactive.
422This tier is at capacityThe tier has reached its member limit.
422Tier is not configured for paymentsThe tier is missing Stripe price configuration.
422You already have an active subscription to this communityUser already has an active or trialing membership.
422Could not create payment intent for subscriptionStripe failed to create the payment intent.

Mobile Implementation Flow

  1. Call this endpoint to retrieve payment credentials
  2. Initialize PaymentSheet using the returned values:
    • payment_intent → PaymentSheet’s paymentIntentClientSecret
    • customer_session_client_secret → PaymentSheet’s customerSessionClientSecret
    • customer → PaymentSheet’s customerId
    • ephemeral_key → PaymentSheet’s customerEphemeralKeySecret
    • publishable_key → Stripe SDK’s publishable key
  3. Present PaymentSheet to the user
  4. Handle completion - on success, the subscription activates via webhook and the user gains membership access

Notes

  • Authorization: Requires authenticated user
  • Free Trials: When has_trial is true, the payment_intent will be a SetupIntent client secret instead of a PaymentIntent, as no charge occurs until the trial ends
  • Subscription Status: The subscription is created with status incomplete and only activates after successful payment confirmation
  • Connected Accounts: Payments are processed on the community’s connected Stripe account, not the platform account