類別
IAPurchaseListener.QueryResponse
public class QueryResponse
{
public string order_id { get; set; }
public string purchase_id { get; set; }
public string status { get; set; }//the value of status is "created" or "processing" or "success" or "failure" or "expired"
public string price { get; set; }
public string currency { get; set; }
public long paid_timestamp { get; set; }
}
| 參數 | 類型 | 描述 |
| order_id | string |
由客戶端產生的唯一訂單 ID。如果為空,則顯示
purchase_id
|
| purchase_id | string | 購買 ID |
| status | string |
購買狀態。可能的值包括:
created
,
processing
,
success
,
failure
和
expired
。
|
| price | string | 總價 |
| currency | string | 貨幣代碼 |
| paid_timestamp | long | 付款時間 (Unix 時間) |
此類別在查詢單個項目時儲存
OnQuerySuccess()
回調和
Query()
函數的購買資訊。
IAPurchaseListener.QueryListResponse
public class QueryListResponse
{
public int total { get; set; }
public int from { get; set; }
public int to { get; set; }
public List<QueryResponse2> purchaseList;
}
| 參數 | 類型 | 描述 |
| total | int | 條目總數,從 1 開始。 |
| from | int | [未使用] 查詢開始範圍,預設為 1 。 |
| to | int |
[未使用] 查詢結束範圍,預設為
== total
。
|
| purchaseList | List< QueryResponse2 > |
此類別在查詢使用者購買的完整清單時儲存
OnQuerySuccess()
回調和
Query()
函數的購買數據。購買將以
QueryResponse2
類型的清單形式回傳。
IAPurchaseListener.QueryResponse2
public class QueryResponse2
{
public string order_id { get; set; }
public string app_id { get; set; }
public string purchase_id { get; set; }
public string user_data { get; set; }
public string price { get; set; }
public string currency { get; set; }
public long paid_timestamp { get; set; }
}
| 參數 | 類型 | 描述 |
| order_id | string |
由客戶端產生的唯一訂單 ID。如果為空,則顯示
purchase_id
|
| purchase_id | string | 購買 ID |
| user_data | string |
Request()
提供的項目名稱
|
| price | string | 總價 |
| currency | string | 貨幣代碼 |
| paid_timestamp | long | 付款時間 (Unix 時間) |
此類別將
QueryList()
類別的購買資訊儲存為大清單的一部分。
IAPurchaseListener.Subscription
public class Subscription
{
public string app_id { get; set; }
public string order_id { get; set; }
public string subscription_id { get; set; }
public string price { get; set; }
public string currency { get; set; }
public long subscribed_timestamp { get; set; }
public TimePeriod free_trial_period { get; set; }
public TimePeriod charge_period { get; set; }
public int number_of_charge_period { get; set; }
public string plan_id { get; set; }
public string plan_name { get; set; }
//the value of status is "created" or "processing" or "failure" or "expired" or "ACTIVE" or "NON_RENEWING" or "CANCELED"
public string status { get; set; }
public StatusDetail status_detail { get; set; }
}
| 參數 | 類型 | 描述 |
| app_id | string | VIVEPORT 開發者主控台中的應用程式 ID |
| order_id | string | 唯一的購買 ID,可用於查詢或取消 |
| subscription_id | string | 特定訂閱的 ID |
| price | string |
換算為使用者貨幣的價格,字串格式為
"1.50"
|
| currency | string | 請參閱貨幣清單 |
| subscribed_timestamp | long | 使用者訂閱的時間 |
| free_trial_period | TimePeriod | 免費試用期。試用期長度固定不變,不會隨試用過程開始而遞減。 |
| charge_period | TimePeriod |
訂閱的收費單位,例如
“month”
或
“day”
|
| number_of_charge_period | int | 收費期數 |
| plan_id | string | 開發者設定的方案 ID |
| plan_name | string | 開發者設定的方案名稱 |
| status | string | 開發者設定的狀態字串 |
| status_detail | StatusDetail | 付款歷史紀錄資訊 |
此類別儲存與訂閱相關的函數數據。
Subscription
回傳訂閱清單時,通常以函數陣列的形式回傳。
請將收費期指定為「月」或「日」。收費期數表示在訂閱期間該單位的數量。例如:
charge_period.timetype ==
“month”
,
charge_period.value ==
1
,
number_of_charge_period ==
12
的結果為按月計費的訂閱期限為一年。
IAPurchaseListener.StatusDetail
public class StatusDetail
{
public long date_next_charge { get; set; }
public StatusDetailTransaction[] transactions { get; set; }
public string cancel_reason { get; set; }
}
| 參數 | 類型 | 描述 |
| date_next_charge | long | 下一結帳日 |
| transactions | StatusDetailTransaction [] | |
| cancel_reason | string | 取消的原因,請參見下文。 |
此類別儲存有關
Subscription
類別交易的數據。
cancel_reason
的可能值
| 值 | 描述 |
| CANCEL | 用戶已取消 |
| OUT_OF_PERIOD | 訂閱已過期 |
| PAYMENT_FAIL | 付款重試次數過多 |
IAPurchaseListener.StatusDetailTransaction
public class StatusDetailTransaction
{
public long create_time { get; set; }
public string payment_method { get; set; }
public string status { get; set; }
//paymentFailed/pendingWebhook/finish
}
| 參數 | 類型 | 描述 |
| create_time | long | 訂購時間 (Unix 時間) |
| payment_method | string | 付款方式 |
| status | string |
目前的狀態。可能的值包括:
paymentFailed
,
pendingWebhook
或
finish
。
|
此類別儲存與
Subscription
類別的付款方式有關的函數數據。
IAPurchaseListener.TimePeriod
public class TimePeriod
{
public string time_type { get; set; }
public int value { get; set; }
}
| 參數 | 類型 | 描述 |
| time_type | string |
"month"
或
"day"
|
| value | int |
TimePeriod
中的
time_type
數量
|
此類別儲存有關
Subscription
類別的付款和訂閱時間長度的資訊。例如,每六個月收費一次的訂閱的
time_type
可能為
“month”
,
value
為
6
。