0
votes

I am integrating HMS IAP with my own server, I tested a subscription purchase and initiated my server to call IAP server API ({rootUrl}/applications/purchases/tokens/verify) to verify the purchase token but I received this message:

{"responseCode":"6","responseMessage":"paymentToken siteID invalid"}

What is "paymentToken siteID invalid"? Am I missing something?

1

1 Answers

0
votes

The IAP server API that you used is for verifying the purchase token for the non-subscription order services. That is why you receive that message.

You should use subscription service API instead - {rootUrl}/sub/applications/v2/purchases/get

You can read more about the api documents here.

Here is an example:

POST /sub/applications/v2/purchases/get
Content-Type: application/json; charset=UTF-8
Authorization: Basic QVQ6Q1YzQ1NPbVlBaGwrZUtRWExtMTBVV2pyWXZHTVF4MmYvcVMya1B0ZElLY3UwaFJrdFNTMmxwdk1FQkIyYldXWGt0REVaR3I4UjFUTTRLMVlmNXdwWU80RG04THdXQWxjaFhEYjBMUjBNTUJtWnFYcGFtazc3THN3UnFJbkhHK28xekdqRzNSMg==
Accept: application/json
Content-Length: 171
{
  "purchaseToken": "00000173741056a37eef310dff9c6a86fec57efafe318ae478e52d9c4261994d64c8f6fc8ea1abbdx5347.5.3089",
  "subscriptionId": "1581789719266.D40972AC.3089"
}

Please also refer to this document - Verifying the Purchase Token for the Subscription Service