React Native Integration
Installation
BASH
# No npm package needed — copy the SDK file below # Optional: in-app browser npm install react-native-inappbrowser-reborn
SDK Implementation
Create LootlyCasherSDK.js:
LOOTLYCASHERSDK.JS
import { Linking } from 'react-native';
import InAppBrowser from 'react-native-inappbrowser-reborn';
const BASE_URL = 'https://lootlycasher.online';
class LootlyCasherSDK {
constructor() {
this.apiKey = '';
this.userId = '';
this.deviceId = '';
this.sandbox = false;
}
initialize(apiKey, userId, deviceId = '', sandbox = false) {
this.apiKey = apiKey;
this.userId = userId;
this.deviceId = deviceId;
this.sandbox = sandbox;
console.log('LootlyCasherSDK initialized for user:', userId);
}
async showOfferwall() {
const sandboxParam = this.sandbox ? '&sandbox=1' : '';
const url = `${BASE_URL}/api/offerwall/${this.apiKey}?user_id=${this.userId}&device_id=${this.deviceId}${sandboxParam}`;
if (await InAppBrowser.isAvailable()) {
await InAppBrowser.open(url, { dismissButtonStyle: 'close', animated: true });
} else {
Linking.openURL(url);
}
}
}
export default new LootlyCasherSDK();