Overview
The PaywallPro API is a RESTful service that enables you to integrate subscription management, feature access control, and usage tracking into your applications. This API handles authentication, subscriber lifecycle, payment webhooks, and real-time feature gating.
Base URL
Common Patterns
- Versioning: API version is specified in the URL path (/v1/)
- Rate Limiting: 1000 requests per hour per API key
- Pagination: Use
?page=1&limit=50for list endpoints - Timestamps: All timestamps are in ISO 8601 format (UTC)
- ID Format: UUIDs (e.g.,
sub_7f3a9b2c1d4e)
Authentication
Authentication Methods
PaywallPro uses JWT (JSON Web Tokens) for secure API access. Each website has a unique API key that can be exchanged for a time-limited access token.
Required Headers
Get Access Token
Exchange your API key for a JWT access token
/v1/auth/token
Request Body:
Response:
Refresh Access Token
Obtain a new access token using a refresh token
/v1/auth/refresh
Request Body:
Subscriber Management
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/subscribers | Create a new subscriber |
| GET | /v1/subscribers/{id} | Get subscriber details |
| GET | /v1/subscribers/{id}/status | Get subscription status |
| PATCH | /v1/subscribers/{id} | Update subscriber information |
| POST | /v1/subscribers/{id}/trials | Activate trial subscription |
Create Subscriber
/v1/subscribers
Request Body:
Response (201 Created):
Get Subscription Status
/v1/subscribers/{id}/status
Response:
Feature Access Control
Feature access control allows you to check if a subscriber has access to specific features and enforce usage limits for metered features.
Check Feature Access
Verify if a subscriber can access a specific feature
/v1/access/check
Request Body:
Response:
Get Feature Limits
Retrieve current usage and limits for a subscriber
/v1/subscribers/{id}/limits
Response:
Limit Exceeded Response
When a feature limit is reached
Webhook Integration
PaywallPro receives webhooks from payment gateways to automatically update subscription statuses. Each provider has a dedicated endpoint with signature verification.
Webhook Endpoints
| Provider | Endpoint | Signature Header |
|---|---|---|
| Stripe | /v1/webhooks/stripe | Stripe-Signature |
| PayPal | /v1/webhooks/paypal | PAYPAL-TRANSMISSION-SIG |
| Paddle | /v1/webhooks/paddle | Paddle-Signature |
All webhook endpoints return 202 Accepted immediately and process events asynchronously. Idempotency is handled automatically using event IDs.
Supported Events
subscription.created- New subscription startedsubscription.updated- Subscription plan changedsubscription.cancelled- Subscription cancelledpayment.succeeded- Payment successfully processedpayment.failed- Payment failedtrial.ending- Trial ending in 3 days
Usage Tracking
Track feature usage for metered billing and analytics. Supports batching for high-volume events.
Record Usage Event
Track a single or batch of usage events
/v1/usage/events
Request Body (Single Event):
Request Body (Batch):
Response (201 Created):
Subscription Lifecycle
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/subscriptions/{id}/change-plan | Upgrade or downgrade plan |
| POST | /v1/subscriptions/{id}/cancel | Cancel subscription |
| POST | /v1/subscriptions/{id}/renew | Manually renew subscription |
| POST | /v1/subscriptions/{id}/reactivate | Reactivate cancelled subscription |
Change Subscription Plan
/v1/subscriptions/{id}/change-plan
Request Body:
Response:
Cancel Subscription
/v1/subscriptions/{id}/cancel
Request Body:
Response:
Error Handling
All API errors follow a consistent JSON structure with HTTP status codes and detailed error information.
Error Response Format
HTTP Status Codes
| Code | Status | Description |
|---|---|---|
| 200 | OK | Request successful |
| 201 | Created | Resource created successfully |
| 202 | Accepted | Request accepted for processing |
| 400 | Bad Request | Invalid request parameters |
| 401 | Unauthorized | Invalid or missing authentication |
| 403 | Forbidden | Insufficient permissions |
| 404 | Not Found | Resource does not exist |
| 409 | Conflict | Resource limit exceeded or duplicate request |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Server-side error occurred |
Common Error Codes
invalid_api_key- API key is invalid or expiredresource_not_found- Requested resource does not existresource_limit_exceeded- Feature usage limit reachedinvalid_request- Request body validation failedrate_limit_exceeded- Too many requests in time windowsubscription_cancelled- Subscription is no longer activepayment_required- Payment method required to proceed