Created
October 14, 2022 11:55
-
-
Save furkanaydgn/b6960c9e125c825f964dcc359b5ccb52 to your computer and use it in GitHub Desktop.
function buy_movie()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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