Chia sẻ phản hồi của bạn:
Chúng tôi muốn nhận phản hồi của bạn về tài liệu dành cho nhà phát triển Microsoft Teams. Vui lòng trả lời khảo sát ba câu hỏi ngắn của chúng tôi.Tham gia khảo sát
Trình duyệt này không còn được hỗ trợ nữa.
Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật.
In-app purchases are upgrade options where users can upgrade from free to paid plans within your app. Microsoft Teams provides APIs to implement in-app purchases. The in-app purchase option is applicable only if the app is enabled with a transactable SaaS offer.
Users can buy new paid subscriptions through in-app purchases. However, they can't purchase additional or different licenses with existing paid subscriptions. To change plans, users must first cancel their current subscription before acquiring a new plan through in-app purchase.
You can activate the in-app purchase experience through one of the following ways:
Update from Developer Portal
In Teams Developer Portal, go to Permissions.
Enable Show in-app purchase offers.
Update manifest
To enable the in-app purchase experience, update your Teams app manifest.json file by adding the RSC permissions. It allows your app users to upgrade to a paid version of your app and access new features. Update the app manifest as given in the following code snippet:
To trigger in-app purchase for the app, invoke the openPurchaseExperience API from your web app. The following code snippet is an example of calling the API from the Teams app built using TeamsJS:
<div>
<divclass="sectionTitle">openPurchaseExperience</div><buttononclick="openPurchaseExperience()">openPurchaseExperience</button></div></body>
<script>
function openPurchaseExperience() {
micorosftTeams.app.initialize();
var planInfo = {
planId: "<Plan id>", // Plan Id of the published SAAS Offer
term: "<Plan Term>" // Term of the plan.
}
monetization.openPurchaseExperience(planInfo);
}
</script>
JavaScript
<div>
<divclass="sectionTitle">openPurchaseExperience</div><buttononclick="openPurchaseExperience()">openPurchaseExperience</button></div></body><script>function openPurchaseExperience()
microsoftTeams.initialize();
let callbackcalled = false;
microsoftTeams.monetization.openPurchaseExperience((e) => {
console.log("callback is being called");
console.log(e);
if (!!e && typeof e !== "string") {
alert(JSON.stringify(e));
}
return;
});
console.log("after callback: ",callbackcalled);
}
</script>
Bạn có thể tìm thấy nguồn cho nội dung này trên GitHub, nơi bạn cũng có thể tạo và xem lại các vấn đề và yêu cầu kéo. Để biết thêm thông tin, hãy xem hướng dẫn dành cho người đóng góp của chúng tôi.
Ý kiến phản hồi về Platform Docs
Platform Docs là một dự án nguồn mở. Chọn liên kết để cung cấp ý kiến phản hồi:
In this module, you'll learn how to monetize your Microsoft Teams apps by selling them through Microsoft AppSource, the Teams app store, and Teams Admin Center.
Thể hiện kỹ năng lập kế hoạch, triển khai, đặt cấu hình và quản lý Microsoft Teams để tập trung vào cộng tác và giao tiếp hiệu quả và hiệu quả trong môi trường Microsoft 365.