跳转至

消费信息传输同意查询

要使用“发送消费信息”功能,用户需要同意**发送关于应用内购买产品的消费信息**。在这方面,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 显示一个弹出式用户界面,询问用户是否同意发送消费信息。它可以在用户购买应用内产品或按下单独按钮时调用,以显示弹出式用户界面,并在调用后返回作为 ResultAPI 和 Boolean 的发送同意结果。

在购买产品或完成购买时,调用Hive SDK的showConsumeInfoAgreement API,询问用户是否同意发送消费信息。您可以显示游戏内的“发送消费信息的同意询问”弹出用户界面,用户的同意结果将存储并管理在Hive 服务器上。

showConsumeInfoAgreement API的功能如下。

  • 在游戏中,“发送消费信息的同意”弹出用户界面也可以显示。因此,用户可以随时更改或撤回他们的同意。
  • 对于第一次被询问的用户或之前拒绝同意的用户,将显示一个请求同意发送消费信息的按钮,而对于之前已同意的用户,将显示一个询问是否撤回同意的按钮。

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

    示例:在撤回或取消后N天的重新暴露

获取消费信息协议

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()) {    
    // Get the user's last agreement value and response time from info, and decide whether to show the popup.
  }    
});

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