/[projects]/android/TrainInfo/src/com/android/vending/billing/IInAppBillingService.aidl
ViewVC logotype

Contents of /android/TrainInfo/src/com/android/vending/billing/IInAppBillingService.aidl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2123 - (show annotations) (download)
Wed Mar 5 12:11:16 2014 UTC (10 years, 2 months ago) by torben
File size: 8443 byte(s)
Add billing code
1 /*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.android.vending.billing;
18
19 import android.os.Bundle;
20
21 /**
22 * InAppBillingService is the service that provides in-app billing version 3 and beyond.
23 * This service provides the following features:
24 * 1. Provides a new API to get details of in-app items published for the app including
25 * price, type, title and description.
26 * 2. The purchase flow is synchronous and purchase information is available immediately
27 * after it completes.
28 * 3. Purchase information of in-app purchases is maintained within the Google Play system
29 * till the purchase is consumed.
30 * 4. An API to consume a purchase of an inapp item. All purchases of one-time
31 * in-app items are consumable and thereafter can be purchased again.
32 * 5. An API to get current purchases of the user immediately. This will not contain any
33 * consumed purchases.
34 *
35 * All calls will give a response code with the following possible values
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
41 * RESULT_ERROR = 6 - Fatal error during the API action
42 * RESULT_ITEM_ALREADY_OWNED = 7 - Failure to purchase since item is already owned
43 * RESULT_ITEM_NOT_OWNED = 8 - Failure to consume since item is not owned
44 */
45 interface IInAppBillingService {
46 /**
47 * Checks support for the requested billing API version, package and in-app type.
48 * Minimum API version supported by this interface is 3.
49 * @param apiVersion the billing version which the app is using
50 * @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
54 */
55 int isBillingSupported(int apiVersion, String packageName, String type);
56
57 /**
58 * Provides details of a list of SKUs
59 * Given a list of SKUs of a valid type in the skusBundle, this returns a bundle
60 * with a list JSON strings containing the productId, price, title and description.
61 * 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 packageName the package name of the calling app
64 * @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST"
65 * @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.
68 * "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 */
73 Bundle getSkuDetails(int apiVersion, String packageName, String type, in Bundle skusBundle);
74
75 /**
76 * Returns a pending intent to launch the purchase flow for an in-app item by providing a SKU,
77 * the type, a unique purchase token and an optional developer payload.
78 * @param apiVersion billing API version that the app is using
79 * @param packageName package name of the calling app
80 * @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).
83 * @param developerPayload optional argument to be sent back with the purchase information
84 * @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.
87 * "BUY_INTENT" - PendingIntent to start the purchase flow
88 *
89 * The Pending intent should be launched with startIntentSenderForResult. When purchase flow
90 * has completed, the onActivityResult() will give a resultCode of OK or CANCELED.
91 * 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.
94 * "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" }'
101 * "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that
102 * was signed with the private key of the developer
103 * TODO: change this to app-specific keys.
104 */
105 Bundle getBuyIntent(int apiVersion, String packageName, String sku, String type,
106 String developerPayload);
107
108 /**
109 * Returns the current SKUs owned by the user of the type and package name specified along with
110 * purchase information and a signature of the data to be validated.
111 * This will return all SKUs that have been purchased in V3 and managed items purchased using
112 * V1 and V2 that have not been consumed.
113 * @param apiVersion billing API version that the app is using
114 * @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).
117 * @param continuationToken to be set as null for the first call, if the number of owned
118 * skus are too many, a continuationToken is returned in the response bundle.
119 * This method can be called again with the continuation token to get the next set of
120 * owned skus.
121 * @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.
124 * "INAPP_PURCHASE_ITEM_LIST" - StringArrayList containing the list of SKUs
125 * "INAPP_PURCHASE_DATA_LIST" - StringArrayList containing the purchase information
126 * "INAPP_DATA_SIGNATURE_LIST"- StringArrayList containing the signatures
127 * of the purchase information
128 * "INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the
129 * next set of in-app purchases. Only set if the
130 * user has more owned skus than the current list.
131 */
132 Bundle getPurchases(int apiVersion, String packageName, String type, String continuationToken);
133
134 /**
135 * Consume the last purchase of the given SKU. This will result in this item being removed
136 * from all subsequent responses to getPurchases() and allow re-purchase of this item.
137 * @param apiVersion billing API version that the app is using
138 * @param packageName package name of the calling app
139 * @param purchaseToken token in the purchase information JSON that identifies the purchase
140 * to be consumed
141 * @return 0 if consumption succeeded. Appropriate error values for failures.
142 */
143 int consumePurchase(int apiVersion, String packageName, String purchaseToken);
144 }

  ViewVC Help
Powered by ViewVC 1.1.20