1
1
/*
2
- * Copyright (C ) 2012 The Android Open Source Project
2
+ * Copyright (c ) 2012 Google Inc.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -34,10 +34,11 @@ import android.os.Bundle;
34
34
*
35
35
* All calls will give a response code with the following possible values
36
36
* RESULT_OK = 0 - success
37
- * RESULT_USER_CANCELED = 1 - user pressed back or canceled a dialog
38
- * RESULT_BILLING_UNAVAILABLE = 3 - this billing API version is not supported for the type requested
39
- * RESULT_ITEM_UNAVAILABLE = 4 - requested SKU is not available for purchase
40
- * RESULT_DEVELOPER_ERROR = 5 - invalid arguments provided to the API
37
+ * RESULT_USER_CANCELED = 1 - User pressed back or canceled a dialog
38
+ * RESULT_SERVICE_UNAVAILABLE = 2 - The network connection is down
39
+ * RESULT_BILLING_UNAVAILABLE = 3 - This billing API version is not supported for the type requested
40
+ * RESULT_ITEM_UNAVAILABLE = 4 - Requested SKU is not available for purchase
41
+ * RESULT_DEVELOPER_ERROR = 5 - Invalid arguments provided to the API
41
42
* RESULT_ERROR = 6 - Fatal error during the API action
42
43
* RESULT_ITEM_ALREADY_OWNED = 7 - Failure to purchase since item is already owned
43
44
* RESULT_ITEM_NOT_OWNED = 8 - Failure to consume since item is not owned
@@ -46,11 +47,11 @@ interface IInAppBillingService {
46
47
/**
47
48
* Checks support for the requested billing API version, package and in-app type.
48
49
* Minimum API version supported by this interface is 3.
49
- * @param apiVersion the billing version which the app is using
50
+ * @param apiVersion billing API version that the app is using
50
51
* @param packageName the package name of the calling app
51
- * @param type type of the in-app item being purchased "inapp" for one-time purchases
52
- * and "subs" for subscription.
53
- * @return RESULT_OK(0) on success, corresponding result code on failures
52
+ * @param type type of the in-app item being purchased ( "inapp" for one-time purchases
53
+ * and "subs" for subscriptions)
54
+ * @return RESULT_OK(0) on success and appropriate response code on failures.
54
55
*/
55
56
int isBillingSupported (int apiVersion , String packageName , String type );
56
57
@@ -59,16 +60,23 @@ interface IInAppBillingService {
59
60
* Given a list of SKUs of a valid type in the skusBundle, this returns a bundle
60
61
* with a list JSON strings containing the productId, price, title and description.
61
62
* This API can be called with a maximum of 20 SKUs.
62
- * @param apiVersion billing API version that the Third-party is using
63
+ * @param apiVersion billing API version that the app is using
63
64
* @param packageName the package name of the calling app
65
+ * @param type of the in-app items ("inapp" for one-time purchases
66
+ * and "subs" for subscriptions)
64
67
* @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST"
65
68
* @return Bundle containing the following key-value pairs
66
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
67
- * failure as listed above .
69
+ * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
70
+ * on failures .
68
71
* "DETAILS_LIST" with a StringArrayList containing purchase information
69
- * in JSON format similar to:
70
- * '{ "productId" : "exampleSku", "type" : "inapp", "price" : "$5.00",
71
- * "title : "Example Title", "description" : "This is an example description" }'
72
+ * in JSON format similar to:
73
+ * '{ "productId" : "exampleSku",
74
+ * "type" : "inapp",
75
+ * "price" : "$5.00",
76
+ * "price_currency": "USD",
77
+ * "price_amount_micros": 5000000,
78
+ * "title : "Example Title",
79
+ * "description" : "This is an example description" }'
72
80
*/
73
81
Bundle getSkuDetails (int apiVersion , String packageName , String type , in Bundle skusBundle );
74
82
@@ -78,26 +86,26 @@ interface IInAppBillingService {
78
86
* @param apiVersion billing API version that the app is using
79
87
* @param packageName package name of the calling app
80
88
* @param sku the SKU of the in-app item as published in the developer console
81
- * @param type the type of the in-app item ("inapp" for one-time purchases
82
- * and "subs" for subscription).
89
+ * @param type of the in-app item being purchased ("inapp" for one-time purchases
90
+ * and "subs" for subscriptions)
83
91
* @param developerPayload optional argument to be sent back with the purchase information
84
92
* @return Bundle containing the following key-value pairs
85
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
86
- * failure as listed above .
93
+ * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
94
+ * on failures .
87
95
* "BUY_INTENT" - PendingIntent to start the purchase flow
88
96
*
89
97
* The Pending intent should be launched with startIntentSenderForResult. When purchase flow
90
98
* has completed, the onActivityResult() will give a resultCode of OK or CANCELED.
91
99
* If the purchase is successful, the result data will contain the following key-value pairs
92
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
93
- * failure as listed above .
100
+ * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response
101
+ * codes on failures .
94
102
* "INAPP_PURCHASE_DATA" - String in JSON format similar to
95
- * '{"orderId":"12999763169054705758.1371079406387615",
96
- * "packageName":"com.example.app",
97
- * "productId":"exampleSku",
98
- * "purchaseTime":1345678900000,
99
- * "purchaseToken" : "122333444455555",
100
- * "developerPayload":"example developer payload" }'
103
+ * '{"orderId":"12999763169054705758.1371079406387615",
104
+ * "packageName":"com.example.app",
105
+ * "productId":"exampleSku",
106
+ * "purchaseTime":1345678900000,
107
+ * "purchaseToken" : "122333444455555",
108
+ * "developerPayload":"example developer payload" }'
101
109
* "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that
102
110
* was signed with the private key of the developer
103
111
* TODO: change this to app-specific keys.
@@ -112,15 +120,15 @@ interface IInAppBillingService {
112
120
* V1 and V2 that have not been consumed.
113
121
* @param apiVersion billing API version that the app is using
114
122
* @param packageName package name of the calling app
115
- * @param type the type of the in-app items being requested
116
- * ("inapp" for one-time purchases and "subs" for subscription).
123
+ * @param type of the in-app items being requested ("inapp" for one-time purchases
124
+ * and "subs" for subscriptions)
117
125
* @param continuationToken to be set as null for the first call, if the number of owned
118
126
* skus are too many, a continuationToken is returned in the response bundle.
119
127
* This method can be called again with the continuation token to get the next set of
120
128
* owned skus.
121
129
* @return Bundle containing the following key-value pairs
122
- * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, other response codes on
123
- * failure as listed above .
130
+ * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
131
+ on failures .
124
132
* "INAPP_PURCHASE_ITEM_LIST" - StringArrayList containing the list of SKUs
125
133
* "INAPP_PURCHASE_DATA_LIST" - StringArrayList containing the purchase information
126
134
* "INAPP_DATA_SIGNATURE_LIST"- StringArrayList containing the signatures
@@ -138,7 +146,47 @@ interface IInAppBillingService {
138
146
* @param packageName package name of the calling app
139
147
* @param purchaseToken token in the purchase information JSON that identifies the purchase
140
148
* to be consumed
141
- * @return 0 if consumption succeeded. Appropriate error values for failures.
149
+ * @return RESULT_OK(0) if consumption succeeded, appropriate response codes on failures.
142
150
*/
143
151
int consumePurchase (int apiVersion , String packageName , String purchaseToken );
152
+
153
+ /**
154
+ * This API is currently under development.
155
+ */
156
+ int stub (int apiVersion , String packageName , String type );
157
+
158
+ /**
159
+ * Returns a pending intent to launch the purchase flow for upgrading or downgrading a
160
+ * subscription. The existing owned SKU(s) should be provided along with the new SKU that
161
+ * the user is upgrading or downgrading to.
162
+ * @param apiVersion billing API version that the app is using, must be 5 or later
163
+ * @param packageName package name of the calling app
164
+ * @param oldSkus the SKU(s) that the user is upgrading or downgrading from,
165
+ * if null or empty this method will behave like {@link #getBuyIntent}
166
+ * @param newSku the SKU that the user is upgrading or downgrading to
167
+ * @param type of the item being purchased, currently must be "subs"
168
+ * @param developerPayload optional argument to be sent back with the purchase information
169
+ * @return Bundle containing the following key-value pairs
170
+ * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
171
+ * on failures.
172
+ * "BUY_INTENT" - PendingIntent to start the purchase flow
173
+ *
174
+ * The Pending intent should be launched with startIntentSenderForResult. When purchase flow
175
+ * has completed, the onActivityResult() will give a resultCode of OK or CANCELED.
176
+ * If the purchase is successful, the result data will contain the following key-value pairs
177
+ * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response
178
+ * codes on failures.
179
+ * "INAPP_PURCHASE_DATA" - String in JSON format similar to
180
+ * '{"orderId":"12999763169054705758.1371079406387615",
181
+ * "packageName":"com.example.app",
182
+ * "productId":"exampleSku",
183
+ * "purchaseTime":1345678900000,
184
+ * "purchaseToken" : "122333444455555",
185
+ * "developerPayload":"example developer payload" }'
186
+ * "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that
187
+ * was signed with the private key of the developer
188
+ * TODO: change this to app-specific keys.
189
+ */
190
+ Bundle getBuyIntentToReplaceSkus (int apiVersion , String packageName ,
191
+ in List <String > oldSkus , String newSku , String type , String developerPayload );
144
192
}
0 commit comments