跳轉至

消費資訊傳輸同意查詢

要使用「發送消費資訊」功能,必須獲得用戶對**發送消費資訊**的同意,該資訊涉及應用內購買產品。在這方面,Hive SDK 提供了一個功能,詢問用戶是否同意將消費資訊發送到市場

Warning

Hive SDK的「詢問是否同意發送消費信息」功能自SDK v4 Native iOS 25.0.0及以上版本可用。

關於「發送消費資訊」

「發送消費資訊」是一項功能,將用戶的消費資訊發送到市場,以分析用戶的消費水平和退款傾向,然後再處理遊戲內購產品的退款。
根據這些資訊,市場提供退款標準,允許遊戲防止用戶的欺詐性使用。

「發送消費信息」功能由 Hive 伺服器 API 提供,關於使用該 API 的詳細信息,請參閱 Hive 伺服器 API > 發送消費信息 指南。

Note

'“發送消費信息”功能目前僅在 Apple AppStore 市場中支持,詳細信息如下。

  • 在 Apple AppStore 內購後,支持 發送消費信息 API,以便順利處理退款並防止詐騙。
  • 要向 Apple 發送退款信息,必須獲得用戶對第三方提供個人信息和海外轉移個人信息的同意,因此 Hive SDK 提供用戶通知條款的 UI,以便用戶同意或撤回同意。

詢問有關發送消費信息的同意

要實現**詢問同意發送消費信息**的應用內購買產品,您必須首先在Hive控制台中為每個遊戲設置發送消費信息功能的使用。更多詳細信息,請參閱控制台指南 > 收費 > 附加服務設置指南。

在 Hive 控制台中配置相关设置后,可以使用以下 Hive SDK 提供的两个 API 实现 发送消费信息的同意查询

  • showConsumeInfoAgreement
  • getConsumeInfoAgreement

showConsumeInfoAgreement

showConsumeInfoAgreement API 顯示一個彈出式 UI,詢問用戶是否同意發送消費信息。當用戶購買應用內產品或按下單獨的按鈕時,可以調用它來顯示彈出式 UI,並在調用後返回作為 ResultAPI 和 Boolean 的發送同意結果。

在購買產品或完成購買時,調用 Hive SDK 的 showConsumeInfoAgreement API 以詢問用戶是否同意發送消費信息。您可以顯示遊戲內的「發送消費信息的同意詢問」彈出 UI,並且同意的結果將存儲並管理在 Hive 伺服器上。

showConsumeInfoAgreement API 的功能如下。

  • 在遊戲中,還可以顯示「同意發送消費信息」的彈出 UI。因此,用戶可以隨時更改或撤回他們的同意。
  • 對於第一次被詢問的用戶或之前拒絕同意的用戶,將顯示一個請求同意發送消費信息的按鈕,而對於之前已同意的用戶,將顯示一個詢問是否撤回同意的按鈕。

    顯示「同意」以發送的範例 顯示「撤回同意」以發送的範例
  • 如果用户撤回他们的同意,'查询发送消费信息的同意'弹出UI可以重新显示。此时,调用getConsumeInfoAgreement API将提供重新显示所需的信息,例如用户的'最后同意状态'和'最后响应时间'。随后,游戏可以参考接收到的值重新显示弹出窗口,如下面的示例所示。

    範例:在撤回或取消後 N 天的重新曝光

getConsumeInfoAgreement

getConsumeInfoAgreement API 會檢索用戶的最後回應信息,並將結果作為 ResultAPI 和一個對象返回。通過調用 getConsumeInfoAgreement API,無需在遊戲中單獨存儲用戶的同意狀態和時間,從而節省資源。

返回的对象作为结果包含用户的最后同意值(布尔值)、第一次响应的时间(整数)和最后一次响应的时间(整数)。对于从未接触过弹出窗口的用户,将返回空值,如果存在先前的响应信息,则这三个值将作为一个单一对象返回。

範例代碼

查詢發送消費者信息的同意 使用提供的API進行實現的示例代碼如下。

showConsumeInfoAgreement

using hive;    
IAPV4.showConsumeInfoAgreement((ResultAPI result, bool didAgree) => {    
  if (result.isSuccess()) {    
    // Check if the user agreed or declined the terms with didAgree.
  }    
});

getConsumeInfoAgreement

using hive;    
IAPV4.getConsumeInfoAgreement((ResultAPI result, IAPV4.IAPV4ConsumeInfoUserAgreement info) => {    
  if (result.isSuccess()) {    
    // 获取用户的最后协议值和响应时间,并决定是否显示弹出窗口。
  }    
});

showConsumeInfoAgreement

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
using namespace std;    
using namespace hive;    
IAPV4::showConsumeInfoAgreement([=](ResultAPI const & result, bool didAgree) {    
  if (result.isSuccess()) {    
    // Check if the user agreed or rejected the terms with didAgree.
  }    
}

getConsumeInfoAgreement

#include <HIVE_SDK_Plugin/HIVE_CPP.h>    
using namespace std;    
using namespace hive;    
IAPV4::getConsumeInfoAgreement([=](ResultAPI const & result, IAPV4ConsumeInfoUserAgreement* _Nullable const & info) {    
  if (result.isSuccess()) {    
    // Get the user's last consent value and response time from info, and decide whether to show the popup.
  }    
}

showConsumeInfoAgreement

import HIVEService    
IAPV4Interface.showConsumeInfoAgreement() { result, didAgree in    
  if result.isSuccess() {    
    // Check whether the user agreed or refused to the terms with didAgree.
  }    
}

getConsumeInfoAgreement

import HIVEService    
IAPV4Interface.getConsumeInfoAgreement() { result, info in    
  if result.isSuccess() {    
    // 获取用户的最后同意值和响应时间,并决定是否显示弹出窗口。
  }    
}

showConsumeInfoAgreement

#import <HIVEService/HIVEService-Swift.h>    
[HIVEIAPV4 showConsumeInfoAgreementWithHandler:^(HIVEResultAPI * result, BOOL didAgree) {    
  if ([result isSuccess]) {    
    // Check if the user agreed or declined the terms with didAgree.
  }    
}];

getConsumeInfoAgreement

#import <HIVEService/HIVEService-Swift.h>    
[HIVEIAPV4 getConsumeInfoAgreementWithHandler:^(HIVEResultAPI * result, HIVEIAPV4ConsumeInfoUserAgreement * info) {    
  if ([result isSuccess]) {    
    // Get the user's last consent value and response time from info, and decide whether to show the popup.
  }    
}];