API Documentation
The Enclose.AI API is organized around REST. Our API has predictable resource-oriented URLs, accepts JSON-encoded request bodies, returns JSON-encoded responses, and uses standard HTTP response codes, authentication, and verbs.
Base URL
https://api.enclose.ai/v1Authentication
The Enclose.AI API uses API keys to authenticate requests. You can view and manage your API keys in your Dashboard. Your API keys carry many privileges, so be sure to keep them secure!
Authentication to the API is performed via Bearer Auth. Provide your API key as the bearer token value.
Authorization: Bearer YOUR_API_KEYAPI Endpoints
/api/v1/checkoutCreate a payment checkout session
/api/v1/paymentsList all payments
/api/v1/payments/:idGet a specific payment
/api/v1/refundsCreate a refund
/api/v1/analyticsGet analytics data
Code Examples
Here's how to create a checkout session using different programming languages:
curl -X POST https://api.enclose.ai/v1/checkout \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 9999,
"currency": "usd",
"product_name": "Premium Plan",
"customer_email": "customer@example.com",
"success_url": "https://your-app.com/success",
"cancel_url": "https://your-app.com/cancel"
}'Response Format
All API responses return JSON. Successful requests return a 200 status code along with the requested data.
{
"success": true,
"checkout_url": "https://checkout.stripe.com/pay/cs_xxx",
"payment_link_id": "pl_1234567890",
"expires_at": "2024-01-01T00:00:00Z"
}Webhooks
Webhooks allow you to receive real-time notifications when events occur in your account. Configure your webhook endpoint in the Dashboard and we'll send POST requests with event data.
Available Events
payment.completed- Payment successfully processedpayment.failed- Payment failedrefund.created- Refund issuedsubscription.created- New subscription started
Rate Limits
The API enforces rate limits to ensure fair usage and platform stability:
- Standard endpoints1000 requests/minute
- Checkout creation100 requests/minute
- Analytics endpoints60 requests/minute
SDKs & Libraries
Official SDKs are available for popular programming languages:
Need Help?
Our developer support team is here to help you integrate successfully.