目录

PurchaseIntentReq

Class Info

public class PurchaseIntentReq extends BaseReq

createPurchaseIntent接口的请求信息。

Public Constructor Summary

Constructor Name

PurchaseIntentReq()

构造一个PurchaseIntentReq对象。

Public Method Summary

Qualifier and Type

Method Name and Description

String

getDeveloperPayload()

获取商户侧保留信息。

int

getPriceType()

获取商品类型。

String

getProductId()

获取商品ID。

String

getSignatureAlgorithm()

获取签名算法。

void

setDeveloperPayload(String developerPayload)

设置商户侧保留信息。

void

setPriceType(int priceType)

设置商品类型。

void

setProductId(String productId)

设置商品ID。

void

setSignatureAlgorithm(String signatureAlgorithm)

设置签名算法。

Methods Inherited from Class com.huawei.hms.iap.entity.BaseReq

getReservedInfor, setReservedInfor

Public Constructors

[h2]PurchaseIntentReq

Constructor

PurchaseIntentReq()

构造一个PurchaseIntentReq对象。

Public Methods

[h2]getDeveloperPayload

Method

public String getDeveloperPayload()

获取商户侧保留信息。

Returns

Type

Description

String

商户侧保留信息。

若该字段有值,在支付成功后的回调结果中会原样返回给应用。

说明:

该参数长度限制为[0, 256]。

[h2]getPriceType

Method

public int getPriceType()

获取商品类型。

Returns

Type

Description

int

商品类型。

  • 0:消耗型商品
  • 1:非消耗型商品
  • 2:订阅型商品

[h2]getProductId

Method

public String getProductId()

获取商品ID。

Returns

Type

Description

String

待支付的商品ID。商品ID来源于您在AppGallery Connect中配置商品信息时设置的“商品ID”,具体请参见新增商品。

说明:

该参数长度限制为(0, 148]。

同一个应用内商品ID不能重复,保存后将无法修改(删除后也无法再次使用)。

[h2]getSignatureAlgorithm

Method

public String getSignatureAlgorithm()

获取签名算法,即您传入的签名算法。

Returns

Type

Description

String

签名算法字段。

[h2]setDeveloperPayload

Method

public void setDeveloperPayload(String developerPayload)

可选。设置商户侧保留信息。

Parameters

Name

Description

developerPayload

商户侧保留信息。

若该字段有值,在支付成功后的回调结果中会原样返回给应用。

说明:

该参数长度限制为[0, 256]。

[h2]setPriceType

Method

public void setPriceType(int priceType)

必选。设置商品类型。

说明:

不设置时默认商品类型为0,即消耗型商品。

Parameters

Name

Description

priceType

商品类型。

  • 0:消耗型商品
  • 1:非消耗型商品
  • 2:订阅型商品

[h2]setProductId

Method

public void setProductId(String productId)

必选。设置商品ID。

Parameters

Name

Description

productId

待支付的商品ID。商品ID来源于您在AppGallery Connect中配置商品信息时设置的“商品ID”,具体请参见新增商品。

说明:

该参数长度限制为(0, 148]。

同一个应用内商品ID不能重复,保存后将无法修改(删除后也无法再次使用)。

[h2]setSignatureAlgorithm

Method

public void setSignatureAlgorithm(String signatureAlgorithm)

可选。设置签名算法。

Parameters

Name

Description

signatureAlgorithm

签名算法字段,可选传入。应用传入此参数后,IAP将使用传入的算法对购买的PMS商品进行签名。该字段当前仅支持传入

SIGNATURE_ALGORITHM_SHA256WITHRSA_PSS,即"SHA256WithRSA/PSS"。

说明:

未传入签名算法时,IAP默认使用SHA256WithRSA算法对购买数据进行签名。

注意:

当您在服务器侧验签时,可使用signatureAlgorithm字段且传值为"SHA256WithRSA/PSS";当您在客户端侧验签时,请勿使用signatureAlgorithm字段。