Advanced Settings and API
Configure advanced features, API access, and developer tools for extended functionality.
Accessing Advanced Settings
Section titled “Accessing Advanced Settings”Navigate to advanced settings:
- Shopify admin → Apps → Alva Digital Downloads
- Click Settings → Advanced
- Configure developer features
Advanced sections:
• API Access• Webhooks• Custom Code• Developer Tools• Performance Tuning• Experimental FeaturesAPI Configuration
Section titled “API Configuration”API Access
Section titled “API Access”Enable API access:
API credentials:
Settings → Advanced → API Access
API Key: [Generate New Key]Generated: ak_live_abc123def456...Created: January 15, 2024Last used: Never
Status: ✓ ActiveRate limit: 1000 requests/hourSecurity:
⚠️ Keep API key secret⚠️ Never commit to version control⚠️ Regenerate if compromised⚠️ Use environment variablesActions:
[Copy API Key][Regenerate Key][Revoke Access][View Usage]API Authentication
Section titled “API Authentication”Authentication methods:
Bearer token:
Header: Authorization: Bearer {api_key}Format: ak_live_abc123def456...Required: All API requests
Example:curl -H "Authorization: Bearer ak_live_abc123..." \ https://yourshop.com/api/filesHMAC signature (webhooks):
Header: X-Alva-HMAC-SHA256Algorithm: HMAC-SHA256Secret: Webhook secretPurpose: Verify webhook authenticityAPI Rate Limiting
Section titled “API Rate Limiting”Rate limit configuration:
Default limits:
Settings → Advanced → API → Rate Limits
Requests per hour: 1000 (default)Burst limit: 100 per minuteConcurrent requests: 10
Headers returned:X-RateLimit-Limit: 1000X-RateLimit-Remaining: 847X-RateLimit-Reset: 1610000000Custom limits:
☐ Enable custom rate limitsHourly: 5000 requestsBurst: 250 per minute
Applies to: This shop onlyEnterprise plans: UnlimitedAPI Endpoints
Section titled “API Endpoints”Available endpoints:
Files API:
GET /api/files - List all filesGET /api/files/{id} - Get file detailsPOST /api/files/upload - Upload new filePUT /api/files/{id} - Update fileDELETE /api/files/{id} - Delete fileOrders API:
GET /api/orders - List digital ordersGET /api/orders/{id} - Get order detailsPOST /api/orders/{id}/approve - Approve flagged orderPOST /api/orders/{id}/reject - Reject flagged orderGET /api/orders/{id}/downloads - Get download logsDownloads API:
POST /api/downloads/generate - Generate download linkGET /api/downloads/{token} - Validate download tokenPOST /api/downloads/{token}/increment - Track downloadDELETE /api/downloads/{token} - Revoke download accessFull documentation:
[View API Documentation]Interactive: Swagger/OpenAPIExamples: All languagesTesting: Built-in API explorerWebhook Configuration
Section titled “Webhook Configuration”Webhook Setup
Section titled “Webhook Setup”Configure webhooks:
Add webhook:
Settings → Advanced → Webhooks → Add Webhook
Endpoint URL: https://yourapp.com/webhooks/alvaEvent types: [Select events]Authentication: HMAC signatureFormat: JSONTimeout: 10 secondsRetry: 3 attempts with exponential backoffWebhook Events
Section titled “Webhook Events”Available events:
Order events:
☑ order.created - New digital order☑ order.approved - Fraud check passed☑ order.rejected - Fraud check failed☑ order.fulfilled - Files delivered☐ order.refunded - Order refundedDownload events:
☑ download.created - New download link☑ download.accessed - Customer downloaded☑ download.limit_reached - Limit exceeded☑ download.expired - Link expired☐ download.revoked - Access revokedFile events:
☐ file.uploaded - New file added☐ file.updated - File modified☐ file.deleted - File removedEmail events:
☐ email.sent - Email sent☐ email.delivered - Email delivered☐ email.opened - Email opened☐ email.clicked - Link clicked☐ email.bounced - Email bouncedWebhook Payload
Section titled “Webhook Payload”Example webhook payload:
Order created:
{ "event": "order.created", "timestamp": "2024-01-15T15:30:00Z", "shop": "yourshop.myshopify.com", "data": { "order_id": "1045", "customer": { "id": "12345", "email": "customer@example.com", "name": "John Smith" }, "products": [ { "id": "67890", "name": "Complete Course Bundle", "files": ["file_1.pdf", "file_2.pdf"], "quantity": 1, "price": "49.99" } ], "total": "49.99", "currency": "USD", "fraud_status": "pending" }, "signature": "abc123..."}Webhook Verification
Section titled “Webhook Verification”Verify webhook authenticity:
HMAC signature verification:
// Node.js exampleconst crypto = require('crypto');
function verifyWebhook(payload, signature, secret) { const hmac = crypto .createHmac('sha256', secret) .update(payload) .digest('base64');
return crypto.timingSafeEqual( Buffer.from(signature), Buffer.from(hmac) );}
// Usageconst isValid = verifyWebhook( req.body, req.headers['x-alva-hmac-sha256'], process.env.WEBHOOK_SECRET);Webhook secret:
Settings → Advanced → Webhooks → Webhook SecretSecret: ws_abc123def456...[Regenerate Secret]
Store: Securely in environment variablesUse: Verify all webhook requestsWebhook Logs
Section titled “Webhook Logs”Monitor webhook delivery:
View logs:
Settings → Advanced → Webhooks → Logs
Columns:• Timestamp• Event type• Endpoint URL• HTTP status• Response time• Retry count• Error message (if failed)
Filter:☐ Failed only☐ Last 24 hours☐ Specific event typeDebugging:
Click log entry → View details:• Request headers• Request payload• Response headers• Response body• Error details• Retry historyCustom Code
Section titled “Custom Code”Custom JavaScript
Section titled “Custom JavaScript”Add custom client-side code:
Inject JavaScript:
Settings → Advanced → Custom Code → JavaScript
// Custom trackingwindow.alvaDownload = function(fileId, fileName) { // Google Analytics if (window.gtag) { gtag('event', 'file_download', { 'event_category': 'Downloads', 'event_label': fileName, 'value': 1 }); }
// Facebook Pixel if (window.fbq) { fbq('track', 'Download', { content_name: fileName, content_ids: [fileId] }); }
// Custom analytics fetch('/api/analytics/track', { method: 'POST', headers: {'Content-Type': 'application/json'}, body: JSON.stringify({ event: 'download', file_id: fileId, file_name: fileName }) });};Injection points:
○ Download page header● Download page footer○ Email templates○ Thank you page extensionCustom CSS
Section titled “Custom CSS”Style customization:
Advanced CSS:
Settings → Advanced → Custom Code → CSS
/* Custom download page styling */.alva-download-page { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); min-height: 100vh; padding: 40px 20px;}
.alva-download-container { background: white; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); max-width: 800px; margin: 0 auto; padding: 40px;}
/* Animated download button */.alva-download-btn { position: relative; overflow: hidden; transition: all 0.3s ease;}
.alva-download-btn::before { content: ''; position: absolute; top: 50%; left: 50%; width: 0; height: 0; border-radius: 50%; background: rgba(255,255,255,0.3); transform: translate(-50%, -50%); transition: width 0.6s, height 0.6s;}
.alva-download-btn:hover::before { width: 300px; height: 300px;}
/* Mobile responsive */@media (max-width: 768px) { .alva-download-container { padding: 20px; border-radius: 8px; }}Liquid Templates (Advanced)
Section titled “Liquid Templates (Advanced)”Custom Liquid templates:
Download page template:
Settings → Advanced → Custom Code → Templates
{% comment %} Custom download page template Variables available: - order - customer - files - download_link{% endcomment %}
<div class="custom-download-page"> <header class="download-header"> {% if shop.logo %} <img src="{{ shop.logo }}" alt="{{ shop.name }}"> {% endif %} <h1>{{ 'downloads.welcome' | t: name: customer.first_name }}</h1> </header>
<section class="order-info"> <h2>{{ 'downloads.order' | t }} #{{ order.number }}</h2> <p>{{ 'downloads.date' | t }}: {{ order.created_at | date: '%B %d, %Y' }}</p> </section>
<section class="files-list"> <h2>{{ 'downloads.files' | t }} ({{ files.size }})</h2>
{% for file in files %} <div class="file-item"> <div class="file-icon"> {% include 'file-icon', type: file.type %} </div> <div class="file-info"> <h3>{{ file.name }}</h3> <p>{{ file.size | file_size }}</p> </div> <a href="{{ file.download_url }}" class="download-btn" data-file-id="{{ file.id }}"> {{ 'downloads.button' | t }} </a> </div> {% endfor %} </section>
<footer class="download-footer"> <p>{{ 'downloads.expiry' | t: days: download.days_until_expiry }}</p> <p>{{ 'downloads.limit' | t: used: download.used, total: download.limit }}</p> </footer></div>Developer Tools
Section titled “Developer Tools”Debug Mode
Section titled “Debug Mode”Enable debugging:
Debug mode:
Settings → Advanced → Developer Tools → Debug Mode☐ Enable debug mode
Warning: ⚠️ Development only, not for production
When enabled:• Verbose logging• Detailed error messages• API request/response logs• Performance metrics• No email sending (test mode)• Test data indicatorsDebug console:
[Open Debug Console]Shows real-time:• API calls• Webhook deliveries• Email attempts• File operations• Error stack tracesRequest Inspector
Section titled “Request Inspector”Inspect API requests:
Request logs:
Settings → Advanced → Developer Tools → Request Inspector
Recent requests:| Time | Method | Endpoint | Status | Duration ||----------|--------|-------------------|--------|----------|| 15:30:12 | GET | /api/files | 200 | 45ms || 15:30:08 | POST | /api/downloads | 201 | 120ms || 15:29:55 | GET | /api/orders/1045 | 200 | 30ms |
Click to view:• Full request headers• Request body• Response headers• Response body• Error detailsAPI Testing
Section titled “API Testing”Test API endpoints:
API explorer:
Settings → Advanced → Developer Tools → API Explorer
Interactive testing:1. Select endpoint2. Fill parameters3. Add headers (auto-includes auth)4. Execute request5. View response
Example:GET /api/filesAuthorization: Bearer ak_live_...
Response:{ "files": [...], "total": 247, "page": 1}Performance Tuning
Section titled “Performance Tuning”Caching Configuration
Section titled “Caching Configuration”Advanced caching:
Cache settings:
Settings → Advanced → Performance → Caching
File caching:Duration: 24 hoursStorage: CDN edge locationsInvalidation: Automatic on update
Page caching:Duration: 1 hourExclude: Dynamic contentVary: By customer, order
Database caching:Query cache: ☑ EnabledDuration: 5 minutesSize: 100 MBCache control:
[Purge All Caches][Purge File Cache][Purge Page Cache][Purge Database Cache]
Last purge: Jan 15, 2024, 2:30 PMCache hit rate: 85%Database Optimization
Section titled “Database Optimization”Database performance:
Query optimization:
Settings → Advanced → Performance → Database
☑ Enable query caching☑ Use read replicas (Enterprise)☑ Auto-index frequently queried fields☑ Vacuum database weekly
Connection pooling:Min connections: 5Max connections: 20Idle timeout: 10 minutesMaintenance:
[Analyze Database][Vacuum Database][Rebuild Indexes][View Slow Queries]
Last maintenance: Jan 14, 2024Database size: 2.4 GBCDN Configuration
Section titled “CDN Configuration”Advanced CDN settings:
CDN optimization:
Settings → Advanced → Performance → CDN
Provider: CloudflareRegions: Global (275+ locations)
Features:☑ Brotli compression☑ HTTP/2☑ HTTP/3 (QUIC)☑ IPv6☑ Early Hints☑ Auto-minify CSS/JS
Cache policies:Static files: 1 yearDownloads: 1 hour (presigned URLs)Pages: 1 hourExperimental Features
Section titled “Experimental Features”Beta Features
Section titled “Beta Features”Try new features:
Available beta features:
Settings → Advanced → Experimental Features
☐ AI-powered file categorization Status: Beta Description: Automatically categorize uploaded files Stability: 90%
☐ Advanced analytics dashboard Status: Alpha Description: Enhanced reporting and insights Stability: 70%
☐ Video streaming optimization Status: Beta Description: Adaptive bitrate streaming Stability: 85%
⚠️ Beta features may change or be removed✓ Feedback appreciatedFeature Flags
Section titled “Feature Flags”Enable/disable features:
Feature toggles:
Settings → Advanced → Feature Flags
☑ Email notifications - STABLE☑ Fraud prevention - STABLE☑ Download page customization - STABLE☐ Watermarking (PDF) - BETA☐ ZIP streaming - EXPERIMENTAL☐ GraphQL API - COMING SOON
Purpose: Gradual rollout, A/B testing, instant rollbackData Export and Backup
Section titled “Data Export and Backup”Advanced Export
Section titled “Advanced Export”Export configuration:
Database export:
Settings → Advanced → Data Export
Export options:☑ All orders☑ All files metadata☑ All customer data☑ All download logs☑ All email logs☑ All settings
Format: JSON / CSV / SQLEncryption: ☑ AES-256Password: [Required for encryption]
[Export Data]Size estimate: 450 MBTime estimate: 2-3 minutesAutomated Backups
Section titled “Automated Backups”Backup configuration:
Backup schedule:
Settings → Advanced → Backups
Automatic backups:☑ Enable automatic backupsFrequency: Daily at 2:00 AM (shop timezone)Retention: 30 daysStorage: Offsite (S3-compatible)
Backup includes:☑ Database (orders, customers, settings)☑ File metadata (not actual files)☑ Configuration☑ Custom code
Backup excludes:☐ Actual files (use cloud storage backup)☐ Email logs (separate retention)Manual backup:
[Create Backup Now]Last backup: Jan 15, 2024, 2:00 AMStatus: ✓ SuccessfulSize: 125 MB[Download] [Restore]Security Settings
Section titled “Security Settings”API Security
Section titled “API Security”Advanced security:
IP whitelist:
Settings → Advanced → Security → API Access
☐ Restrict API access to specific IPsAllowed IPs:• 192.168.1.100 (Office)• 10.0.0.5 (Server)
Apply to:☑ API endpoints☑ Webhook endpoints☐ Download endpointsWebhook Security
Section titled “Webhook Security”Webhook authentication:
Security options:
Settings → Advanced → Security → Webhooks
☑ Require HMAC signature☑ Require HTTPS☑ Verify SSL certificates☐ Use mutual TLS (mTLS)
Replay protection:☑ Timestamp validationTolerance: 5 minutes
IP restrictions:☐ Limit to specific IPsMonitoring and Alerts
Section titled “Monitoring and Alerts”Performance Monitoring
Section titled “Performance Monitoring”Monitor app performance:
Performance metrics:
Settings → Advanced → Monitoring
Real-time metrics:• API response time: 45ms avg• Download speed: 25 MB/s avg• Database query time: 8ms avg• Cache hit rate: 85%• Error rate: 0.05%
Alerts:☑ Alert if response time > 500ms☑ Alert if error rate > 1%☑ Alert if cache hit < 70%Error Tracking
Section titled “Error Tracking”Track and fix errors:
Error monitoring:
Settings → Advanced → Monitoring → Errors
Recent errors:| Time | Type | Message | Count | Status ||----------|---------------|-------------------|-------|--------|| 15:30:00 | API | Rate limit hit | 1 | Fixed || 14:20:15 | Download | Token expired | 3 | Normal || 12:45:30 | Email | SMTP timeout | 1 | Fixed |
Click to view:• Stack trace• Request details• User impact• Resolution stepsIntegrations:
☐ Sentry integration☐ Bugsnag integration☐ Custom error webhookGraphQL API (Beta)
Section titled “GraphQL API (Beta)”GraphQL Configuration
Section titled “GraphQL Configuration”Enable GraphQL:
GraphQL endpoint:
Settings → Advanced → GraphQL (Beta)
☐ Enable GraphQL APIEndpoint: https://yourshop.com/api/graphqlPlayground: https://yourshop.com/api/graphql/playground
Authentication: Bearer token (same as REST API)Rate limit: Shared with REST APIExample query:
query GetOrder($orderNumber: String!) { order(number: $orderNumber) { id number createdAt customer { id name email } files { id name size downloadUrl } downloads { count limit expiryDate } }}Best Practices
Section titled “Best Practices”1. Secure API Keys
Section titled “1. Secure API Keys”Security:
✓ Store in environment variables✓ Never commit to version control✓ Rotate regularly (every 90 days)✓ Use different keys for dev/prod✓ Revoke immediately if compromised2. Validate Webhooks
Section titled “2. Validate Webhooks”Always verify:
✓ Check HMAC signature✓ Validate timestamp (prevent replay)✓ Verify payload structure✓ Log all webhook attempts✓ Handle retries properly3. Handle Rate Limits
Section titled “3. Handle Rate Limits”Rate limit handling:
// Check rate limit headersconst remaining = response.headers['x-ratelimit-remaining'];const reset = response.headers['x-ratelimit-reset'];
if (remaining < 10) { // Slow down requests await sleep(1000);}
// Handle 429 responsesif (response.status === 429) { const retryAfter = response.headers['retry-after']; await sleep(retryAfter * 1000); // Retry request}4. Use Webhooks for Real-Time
Section titled “4. Use Webhooks for Real-Time”Prefer webhooks:
✓ Real-time updates✓ No polling needed✓ Efficient use of API quota✓ Better user experience
vs. Polling (avoid):❌ Wastes API calls❌ Delayed updates❌ Inefficient5. Monitor and Debug
Section titled “5. Monitor and Debug”Production monitoring:
✓ Set up error tracking✓ Monitor performance metrics✓ Configure alerts✓ Review logs regularly✓ Test integrations thoroughlyTroubleshooting
Section titled “Troubleshooting”API Requests Failing
Section titled “API Requests Failing”Check:
1. API key valid and not expired2. Correct authentication header3. Rate limit not exceeded4. Endpoint URL correct5. Request payload validTest:
curl -H "Authorization: Bearer {key}" \ https://yourshop.com/api/health
Expected: 200 OKWebhooks Not Received
Section titled “Webhooks Not Received”Debug:
1. Check webhook logs for delivery attempts2. Verify endpoint URL accessible3. Check HTTPS certificate valid4. Test webhook endpoint manually5. Review firewall/IP restrictionsPerformance Issues
Section titled “Performance Issues”Optimize:
1. Enable caching2. Use CDN for file delivery3. Optimize database queries4. Check rate limits5. Review error logsNext Steps
Section titled “Next Steps”- General Settings Overview - Basic settings
- Shop Settings and Preferences - Shop configuration
- Email Settings Configuration - Email setup