Backend Server Integrations
Your backend server plays a critical role in managing the purchase lifecycle and securing legitimacy of your app's transactions. While the Android Billing SDK handles the client-side user interface and payment flow, Aptoide’s Backend APIs ensure that transactions are verified, synchronized, and managed securely.
Integrating these APIs allows you to move sensitive logic away from the client, preventing fraud and ensuring users receive their digital products reliably across all devices.
Key Backend Functionalities
Integrating with Aptoide's backend services unlocks three primary capabilities:
1. Purchase Lifecycle Management
Monitoring purchase events is essential for accurate entitlement management. Aptoide Connect sends Real-Time Developer Notifications (RTDN) for changes like successful purchases, renewals or cancellations. This allows your server to update user access immediately without requiring the user to open the app, leading to more user satisfaction.
2. Fraud Prevention & Verification
To protect your revenue, you should always verify a purchase before granting access to premium content.
- Server-to-Server Validation: After a Purchase is made, securely confirm the legitimacy of the transaction directly with Aptoide's services.
- Voided Purchases: Automatically detect refunded or charged-back transactions to revoke access to features and prevent "double-dipping."
3. Source of Truth Synchronization
By leveraging these APIs, your server maintains an accurate record that mirrors Aptoide's billing system. This prevents discrepancies caused by different behaviors on the device and ensures a seamless experience for users.
Core Backend Components
In-App Purchase Validation (Server-to-Server)
The Server-to-Server (S2S) validation is your primary line of defense against billing fraud. Once a purchase is completed on the Android device, your app should send the purchase token to your server, which then verifies it directly with Aptoide.
- Secure Fulfillment: Only grant items after a successful
200 OKresponse from the Aptoide Verification API. - Integrity Check: Ensures the purchase wasn't tampered with or replayed by a malicious user.
Real-Time Developer Notifications (RTDNs)
RTDN is a push-based mechanism. Instead of your server constantly polling Aptoide for updates, Aptoide sends an HTTP POST request to your registered callback URL the moment a state change occurs.
- Subscription Updates: Real-time info on renewals or expirations.
- One-Time Purchases: Confirmation of successful payments.
Voided Purchases
This API provides a list of transactions that have been voided (refunded or charged-back). Regularly checking this list ensures that your backend remains synchronized with the actual financial status of your users.
- Maintain Economy: Revoke items or currency associated with voided orders.
- Security: Identify potential bad actors who frequently request refunds.
Implementation Best Practices
- Use Order IDs: Always use the unique
orderIdof Aptoide and yourdeveloperPayloadto link transactions to your internal user accounts. - HTTPS Only: Ensure your callback URLs use secure HTTPS connections to protect transaction data in transit.