InAppify

PHP REST API examples

Connect PHP and Laravel backends to InAppify with safe authentication and error handling.

<?php

$response = Http::baseUrl(config('services.inappify.url').'/api/v1')
    ->withToken(config('services.inappify.secret'))
    ->acceptJson()
    ->timeout(15)
    ->get('/subscribers/customer_123');

if ($response->failed()) {
    throw new RuntimeException(
        'InAppify API error '.$response->status().': '.$response->json('message')
    );
}

$customer = $response->json('data');

For offerings, add ->withHeader('X-InAppify-App-ID', 'android_app'). For JSON requests, use post($path, $payload). Store the secret in a server-side environment variable and never expose it to client code. Retry network failures, 429, and temporary 5xx errors only.