제품을 확인합니다.
acknowledgePurchaseAndroid(
/** The product's token */
token: string,
/** Android developerPayload */
developerPayload?: string,
): Promise<PurchaseResult | void>;
import React from 'react';
import {Button} from 'react-native';
import {acknowledgePurchaseAndroid} from 'react-native-iap';
const App = () => {
const handlePurchase = async () => {
await acknowledgePurchaseAndroid({
token: 'token',
developerPayload: 'developer-payload',
});
};
return <Button title="Acknowledge purchase" onPress={handlePurchase} />;
}
구독 화면에 대한 심층 링크입니다.
deepLinkToSubscriptionsAndroid(
/** The product's SKU */
sku: Sku,
): Promise<void>;
import React from 'react';
import {Button} from 'react-native';
import {deepLinkToSubscriptionsAndroid} from 'react-native-iap';
const App = () => {
const handleSubscriptions = async () => {
await deepLinkToSubscriptionsAndroid({sku: 'sku-id'});
};
return <Button title="Manage subscriptions" onPress={handleSubscriptions} />;
};
Consume all 'ghost' purchases.
이미 실패했지만 여전히 Play Store 캐시에 보류 중으로 표시된 보류 중인 결제입니다.
flushFailedPurchasesCachedAsPendingAndroid(): Promise<void>;
import React from 'react';
import {Button} from 'react-native';
import {flushFailedPurchasesCachedAsPendingAndroid} from 'react-native-iap';
const App = () => {
const handleFlush = async () => {
await flushFailedPurchasesCachedAsPendingAndroid();
};
return (
<Button title="Flush purchases cache" onPress={handleFlush} />
);
}
영수증을 확인합니다.
이 메서드는 디버깅 목적으로만 사용됩니다. 사용자에게 제공하는 이진 파일에 액세스 토큰을 포함하는 것은 잠재적으로 위험합니다. 프로덕션 빌드에 서버 측 유효성 검사를 대신 사용하십시오.
validateReceiptAndroid(
/** package name of your app. */
packageName: string,
/** product id for your in app product. */
productId: string,
/** token for your purchase. */
productToken: string,
/** accessToken from googleApis. */
accessToken: string,
/** whether this is a subscription or in-app product. `true` for subscription. */
isSub?: boolean,
): Promise<ProductPurchase | SubscriptionPurchase>;
import React from 'react';
import {Button} from 'react-native';
import {validateReceiptAndroid} from 'react-native-iap';
const App = () => {
const handlePurchase = async () => {
const response = await validateReceiptAndroid({
packageName: purchase.packageNameAndroid,
productId: purchase.productId,
productToken: purchase.purchaseToken,
accessToken: 'your-access-token',
isSub: true
});
};
return <Button title="Purchase" onPress={handlePurchase} />;
}