// Your app’s code
import { adapty, activateAdapty } from "react-native-adapty";
const App: = () => {
useEffect(() => {
activateAdapty({ sdkKey: PUBLIC_SDK_KEY });
},[]);
const result = await adapty.purchases.makePurchase('product_id');
// If makePurchase didn't throw an error, everything's fine
}
// Your app's code
await Adapty.activate("PUBLIC_SDK_KEY",
customerUserId: "YOUR_USER_ID");
// Make a purchase, Adapty handles the rest
final MakePurchaseResult makePurchaseResult =
await
Adapty.makePurchase(product);
if (makePurchaseResult?.purchaserInfo?.accessLevels
['premium'].isActive) {
// grant access to premium features
}
// Your app's code
Adapty.identify("your_user_id", this);
// Make a purchase, Adapty handles the rest
Adapty.makePurchase(product, null, this);
public void OnMakePurchase(PurchaserInfoModel purchaserInfo, string receipt, Dictionary<string, object> validationResult, ProductModel product, AdaptyError error) {
if (error == null) {
// successful purchase
}
}