Documentation Index
Fetch the complete documentation index at: https://mintlify.com/egeuysall/ryva-archive/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Billing endpoints handle subscription management, checkout sessions, and payment processing through Stripe. These endpoints allow you to create subscriptions, manage billing portals, and handle webhooks.All billing endpoints (except webhooks) require JWT authentication.
Create Checkout Session
/v1/billing/checkout
Request Headers
Optional idempotency key to prevent duplicate checkout sessions
Request Body
Organization ID (UUID) to subscribe
Stripe Price ID (e.g.,
price_1234567890)URL to redirect to after successful payment
URL to redirect to if user cancels
Response
Stripe Checkout Session ID
URL to redirect user to for checkout
Client secret for embedded checkout (if applicable)
true if subscription was updated immediately without checkoutExample
Verify Checkout Session
/v1/billing/session/:session_id
Path Parameters
Stripe Checkout Session ID
Response
Whether the session is valid and payment succeeded
Stripe Session ID
Organization ID
Subscription plan name
Payment status:
paid, unpaid, or no_payment_requiredStripe Subscription ID (if subscription created)
Customer email from Stripe
Total amount paid in cents
Currency code (e.g.,
usd)Example
Create Billing Portal Session
/v1/billing/portal
Request Body
Organization ID (UUID)
URL to redirect to when user exits the portal
Response
URL to redirect user to for the billing portal
Example
Get Subscription Status
/v1/billing/organizations/:id/subscription
Path Parameters
Organization ID (UUID)
Response
Subscription ID
Organization ID
Subscription plan:
free, personal, or teamSubscription status:
active, canceled, past_due, trialing, etc.Start of current billing period
End of current billing period
Whether subscription will cancel at period end
When subscription was canceled (if applicable)
Trial period start (if applicable)
Trial period end (if applicable)
When subscription was created
When subscription was last updated
Example
Cancel Subscription
/v1/billing/organizations/:id/subscription/cancel
Path Parameters
Organization ID (UUID)
Request Body
If
true, subscription continues until period end. If false, cancels immediately.Response
Subscription ID
Updated subscription status
Whether subscription will cancel at period end
When the subscription will end
Example
Stripe Webhooks
/v1/billing/webhooks/stripe
Request Headers
Stripe webhook signature for verification
Supported Events
The API handles the following Stripe webhook events:checkout.session.completed- Checkout session completedcustomer.subscription.created- New subscription createdcustomer.subscription.updated- Subscription updatedcustomer.subscription.deleted- Subscription canceledinvoice.payment_succeeded- Payment succeededinvoice.payment_failed- Payment failed
Response
Configuration
Configure your Stripe webhook endpoint:- Go to Stripe Dashboard > Developers > Webhooks
- Add endpoint:
https://api.ryva.com/v1/billing/webhooks/stripe - Select events to send
- Copy the webhook signing secret to your API configuration
Subscription Statuses
| Status | Description |
|---|---|
active | Subscription is active and in good standing |
trialing | Subscription is in trial period |
past_due | Payment failed, attempting to retry |
canceled | Subscription has been canceled |
unpaid | Payment failed and no more retry attempts |
incomplete | Initial payment failed |
incomplete_expired | Initial payment failed and grace period expired |