This API endpoint creates checkout URLs without requiring prior user authentication. It automatically handles user creation and returns a payment URL.
Basic Setup
Endpoint
POST https://onlineapp.pro/api/v1/paywall/{paywallId}/start-checkout
Authentication
Include the
x-api-key
header with your API key.How to get your API key
- Log into your account
- Navigate to "Settings" → "API Keys"
- Create new or copy existing key
Request Details
URL Parameters
paywallId
(string, required) - Your paywall identifier
Request Body
{ "email": "user@example.com", "priceId": "456", "successUrl": "https://mysite.com/payment/success", "errorUrl": "https://mysite.com/payment/error", "shopUrl": "https://mysite.com/shop", "ignoreActivePurchase": false }
How to get price ID? Use this API: Get prices
How to get paywall ID? Go to paywall settings page and take it from URL.
For example:
https://monetize.software/en/publisher/paywalls/547
Paywall ID is 547
Required Fields
- `email` - User's email address
- `priceId` - Price identifier
Optional Fields
- `successUrl` - Redirect URL for successful payment
- `errorUrl` - Redirect URL for failed payment
- `shopUrl` - Return URL for payment system
- `ignoreActivePurchase` - Allow checkout with active subscription (default: false)
Sample Implementation
const paywallId = '123'; const response = await fetch(`/api/v1/paywall/${paywallId}/start-checkout`, { method: 'POST', headers: { 'Content-Type': 'application/json', 'x-api-key': 'your-secret-api-key' }, body: JSON.stringify({ email: 'user@example.com', priceId: '456', successUrl: 'https://mysite.com/payment/success', errorUrl: 'https://mysite.com/payment/error', shopUrl: 'https://mysite.com/shop', ignoreActivePurchase: true }) });
Response Format
{ "checkoutUrl": "https://checkout.stripe.com/c/pay/cs_test_...", "userId": "uuid-of-user", "acquiring": "stripe" }
Error Handling
Common Error Responses
- 400 - Bad Request (missing parameters, invalid format)
- 401 - Unauthorized (invalid API key)
- 409 - Conflict (active purchase exists)
- 500 - Internal Server Error
Process Flow
- Validate parameters and email format
- Check URL formats
- Verify API key
- Find or create user
- Link to paywall
- Check active purchases
- Create payment session
Security Guidelines
- Store API keys securely
- Use HTTPS for all requests
- Validate email formats
- Verify URL formats
- Check for active purchases
Integration
After receiving the checkout URL, redirect the user:
window.location.href = data.checkoutUrl; // or window.open(data.checkoutUrl, '_blank');
Payment Status Tracking
💡 Webhooks are recommended for tracking payment status
Alternative Methods
- Monitor redirect URLs
- Use Customer Portal
Important: Webhooks provide the most reliable payment tracking, ensuring notification delivery even if users close their browsers after payment.