Skip to content

Instantly share code, notes, and snippets.

@furkanaydgn
Created October 14, 2022 11:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save furkanaydgn/b6960c9e125c825f964dcc359b5ccb52 to your computer and use it in GitHub Desktop.
Save furkanaydgn/b6960c9e125c825f964dcc359b5ccb52 to your computer and use it in GitHub Desktop.
function buy_movie()
async function buy_movie() {
alert("buy_movie");
try {
let message = await HMSInAppPurchases.createPurchaseIntent({
priceType: PRICETYPE.CONSUMABLE,
productId: "test_movie_item_2",
developerPayload: "HMSCoreDeveloper",
});
console.log(JSON.stringify(message, ["returnCode", "errMsg", "inAppPurchaseData", "inAppDataSignature", "signatureAlgorithm"]));
if (message.returnCode === 0) {// if successful
createPurchasedProductOnList(product.productId, message.inAppPurchaseData, productType)
} else {
alert(JSON.stringify(message, null, 4))
console.log('Purchase was not successful.')
}
} catch (err) {
defaultErrorHandler(err);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment