跳轉至

針對同意發送消費者資訊的詢問

要使用「發送消費資訊」功能,必須獲得用戶對於**發送消費資訊**的同意,這些資訊涉及應用內購買產品。在這方面,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 提供了一個用戶界面,讓用戶可以被通知條款並同意或撤回同意。

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

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

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

  • showConsumeInfoAgreement
  • getConsumeInfoAgreement

showConsumeInfoAgreement

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

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

showConsumeInfoAgreement API 的功能如下。

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

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

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

獲取消費資訊協議

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

作為結果返回的對象包含用戶的最後同意值(布林值)、第一次回應的時間(整數)和最後一次回應的時間(整數)。對於從未接觸過彈出窗口的用戶,返回的值為null,如果存在之前的回應信息,則這三個值作為一個單一對象返回。

範例代碼

查詢發送消費者信息的同意 使用提供的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 "HiveIAPV4.h"

FHiveIAPV4::ShowConsumeInfoAgreement(FHiveIAPV4OnShowConsumeInfoAgreementDelegate::CreateLambda([this](const FHiveResultAPI& Result, bool DidAgree) {
  if (Result.IsSuccess()) {
    // Find out whether the user agreed or declined the terms with didAgree.
}));

getConsumeInfoAgreement

#include "HiveIAPV4.h"

FHiveIAPV4::GetConsumeInfoAgreement(
  FHiveIAPV4OnGetConsumeInfoAgreementDelegate::CreateLambda([this](const FHiveResultAPI& Result, const FHiveIAPV4ConsumeInfoUserAgreement& 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()) {    
    // 从信息中获取用户的最后同意值和响应时间,并决定是否显示弹出窗口。
  }    
}

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.
  }    
}];