The JUCE cross-platform C++ framework, with DISTRHO/KXStudio specific changes
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

972 lines
60KB

  1. /*
  2. ==============================================================================
  3. This file is part of the JUCE library.
  4. Copyright (c) 2017 - ROLI Ltd.
  5. JUCE is an open source library subject to commercial or open-source
  6. licensing.
  7. The code included in this file is provided under the terms of the ISC license
  8. http://www.isc.org/downloads/software-support-policy/isc-license. Permission
  9. To use, copy, modify, and/or distribute this software for any purpose with or
  10. without fee is hereby granted provided that the above copyright notice and
  11. this permission notice appear in all copies.
  12. JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
  13. EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
  14. DISCLAIMED.
  15. ==============================================================================
  16. */
  17. package com.android.vending.billing;
  18. /**
  19. * InAppBillingService is the service that provides in-app billing version 3 and beyond.
  20. * This service provides the following features:
  21. * 1. Provides a new API to get details of in-app items published for the app including
  22. * price, type, title and description.
  23. * 2. The purchase flow is synchronous and purchase information is available immediately
  24. * after it completes.
  25. * 3. Purchase information of in-app purchases is maintained within the Google Play system
  26. * till the purchase is consumed.
  27. * 4. An API to consume a purchase of an inapp item. All purchases of one-time
  28. * in-app items are consumable and thereafter can be purchased again.
  29. * 5. An API to get current purchases of the user immediately. This will not contain any
  30. * consumed purchases.
  31. *
  32. * All calls will give a response code with the following possible values
  33. * RESULT_OK = 0 - success
  34. * RESULT_USER_CANCELED = 1 - User pressed back or canceled a dialog
  35. * RESULT_SERVICE_UNAVAILABLE = 2 - The network connection is down
  36. * RESULT_BILLING_UNAVAILABLE = 3 - This billing API version is not supported for the type requested
  37. * RESULT_ITEM_UNAVAILABLE = 4 - Requested SKU is not available for purchase
  38. * RESULT_DEVELOPER_ERROR = 5 - Invalid arguments provided to the API
  39. * RESULT_ERROR = 6 - Fatal error during the API action
  40. * RESULT_ITEM_ALREADY_OWNED = 7 - Failure to purchase since item is already owned
  41. * RESULT_ITEM_NOT_OWNED = 8 - Failure to consume since item is not owned
  42. */
  43. public interface IInAppBillingService extends android.os.IInterface
  44. {
  45. /** Local-side IPC implementation stub class. */
  46. public static abstract class Stub extends android.os.Binder implements com.android.vending.billing.IInAppBillingService
  47. {
  48. private static final java.lang.String DESCRIPTOR = "com.android.vending.billing.IInAppBillingService";
  49. /** Construct the stub at attach it to the interface. */
  50. public Stub()
  51. {
  52. this.attachInterface(this, DESCRIPTOR);
  53. }
  54. /**
  55. * Cast an IBinder object into an com.android.vending.billing.IInAppBillingService interface,
  56. * generating a proxy if needed.
  57. */
  58. public static com.android.vending.billing.IInAppBillingService asInterface(android.os.IBinder obj)
  59. {
  60. if ((obj==null)) {
  61. return null;
  62. }
  63. android.os.IInterface iin = obj.queryLocalInterface(DESCRIPTOR);
  64. if (((iin!=null)&&(iin instanceof com.android.vending.billing.IInAppBillingService))) {
  65. return ((com.android.vending.billing.IInAppBillingService)iin);
  66. }
  67. return new com.android.vending.billing.IInAppBillingService.Stub.Proxy(obj);
  68. }
  69. @Override public android.os.IBinder asBinder()
  70. {
  71. return this;
  72. }
  73. @Override public boolean onTransact(int code, android.os.Parcel data, android.os.Parcel reply, int flags) throws android.os.RemoteException
  74. {
  75. switch (code)
  76. {
  77. case INTERFACE_TRANSACTION:
  78. {
  79. reply.writeString(DESCRIPTOR);
  80. return true;
  81. }
  82. case TRANSACTION_isBillingSupported:
  83. {
  84. data.enforceInterface(DESCRIPTOR);
  85. int _arg0;
  86. _arg0 = data.readInt();
  87. java.lang.String _arg1;
  88. _arg1 = data.readString();
  89. java.lang.String _arg2;
  90. _arg2 = data.readString();
  91. int _result = this.isBillingSupported(_arg0, _arg1, _arg2);
  92. reply.writeNoException();
  93. reply.writeInt(_result);
  94. return true;
  95. }
  96. case TRANSACTION_getSkuDetails:
  97. {
  98. data.enforceInterface(DESCRIPTOR);
  99. int _arg0;
  100. _arg0 = data.readInt();
  101. java.lang.String _arg1;
  102. _arg1 = data.readString();
  103. java.lang.String _arg2;
  104. _arg2 = data.readString();
  105. android.os.Bundle _arg3;
  106. if ((0!=data.readInt())) {
  107. _arg3 = android.os.Bundle.CREATOR.createFromParcel(data);
  108. }
  109. else {
  110. _arg3 = null;
  111. }
  112. android.os.Bundle _result = this.getSkuDetails(_arg0, _arg1, _arg2, _arg3);
  113. reply.writeNoException();
  114. if ((_result!=null)) {
  115. reply.writeInt(1);
  116. _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
  117. }
  118. else {
  119. reply.writeInt(0);
  120. }
  121. return true;
  122. }
  123. case TRANSACTION_getBuyIntent:
  124. {
  125. data.enforceInterface(DESCRIPTOR);
  126. int _arg0;
  127. _arg0 = data.readInt();
  128. java.lang.String _arg1;
  129. _arg1 = data.readString();
  130. java.lang.String _arg2;
  131. _arg2 = data.readString();
  132. java.lang.String _arg3;
  133. _arg3 = data.readString();
  134. java.lang.String _arg4;
  135. _arg4 = data.readString();
  136. android.os.Bundle _result = this.getBuyIntent(_arg0, _arg1, _arg2, _arg3, _arg4);
  137. reply.writeNoException();
  138. if ((_result!=null)) {
  139. reply.writeInt(1);
  140. _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
  141. }
  142. else {
  143. reply.writeInt(0);
  144. }
  145. return true;
  146. }
  147. case TRANSACTION_getPurchases:
  148. {
  149. data.enforceInterface(DESCRIPTOR);
  150. int _arg0;
  151. _arg0 = data.readInt();
  152. java.lang.String _arg1;
  153. _arg1 = data.readString();
  154. java.lang.String _arg2;
  155. _arg2 = data.readString();
  156. java.lang.String _arg3;
  157. _arg3 = data.readString();
  158. android.os.Bundle _result = this.getPurchases(_arg0, _arg1, _arg2, _arg3);
  159. reply.writeNoException();
  160. if ((_result!=null)) {
  161. reply.writeInt(1);
  162. _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
  163. }
  164. else {
  165. reply.writeInt(0);
  166. }
  167. return true;
  168. }
  169. case TRANSACTION_consumePurchase:
  170. {
  171. data.enforceInterface(DESCRIPTOR);
  172. int _arg0;
  173. _arg0 = data.readInt();
  174. java.lang.String _arg1;
  175. _arg1 = data.readString();
  176. java.lang.String _arg2;
  177. _arg2 = data.readString();
  178. int _result = this.consumePurchase(_arg0, _arg1, _arg2);
  179. reply.writeNoException();
  180. reply.writeInt(_result);
  181. return true;
  182. }
  183. case TRANSACTION_stub:
  184. {
  185. data.enforceInterface(DESCRIPTOR);
  186. int _arg0;
  187. _arg0 = data.readInt();
  188. java.lang.String _arg1;
  189. _arg1 = data.readString();
  190. java.lang.String _arg2;
  191. _arg2 = data.readString();
  192. int _result = this.stub(_arg0, _arg1, _arg2);
  193. reply.writeNoException();
  194. reply.writeInt(_result);
  195. return true;
  196. }
  197. case TRANSACTION_getBuyIntentToReplaceSkus:
  198. {
  199. data.enforceInterface(DESCRIPTOR);
  200. int _arg0;
  201. _arg0 = data.readInt();
  202. java.lang.String _arg1;
  203. _arg1 = data.readString();
  204. java.util.List<java.lang.String> _arg2;
  205. _arg2 = data.createStringArrayList();
  206. java.lang.String _arg3;
  207. _arg3 = data.readString();
  208. java.lang.String _arg4;
  209. _arg4 = data.readString();
  210. java.lang.String _arg5;
  211. _arg5 = data.readString();
  212. android.os.Bundle _result = this.getBuyIntentToReplaceSkus(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5);
  213. reply.writeNoException();
  214. if ((_result!=null)) {
  215. reply.writeInt(1);
  216. _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
  217. }
  218. else {
  219. reply.writeInt(0);
  220. }
  221. return true;
  222. }
  223. case TRANSACTION_getBuyIntentExtraParams:
  224. {
  225. data.enforceInterface(DESCRIPTOR);
  226. int _arg0;
  227. _arg0 = data.readInt();
  228. java.lang.String _arg1;
  229. _arg1 = data.readString();
  230. java.lang.String _arg2;
  231. _arg2 = data.readString();
  232. java.lang.String _arg3;
  233. _arg3 = data.readString();
  234. java.lang.String _arg4;
  235. _arg4 = data.readString();
  236. android.os.Bundle _arg5;
  237. if ((0!=data.readInt())) {
  238. _arg5 = android.os.Bundle.CREATOR.createFromParcel(data);
  239. }
  240. else {
  241. _arg5 = null;
  242. }
  243. android.os.Bundle _result = this.getBuyIntentExtraParams(_arg0, _arg1, _arg2, _arg3, _arg4, _arg5);
  244. reply.writeNoException();
  245. if ((_result!=null)) {
  246. reply.writeInt(1);
  247. _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
  248. }
  249. else {
  250. reply.writeInt(0);
  251. }
  252. return true;
  253. }
  254. case TRANSACTION_getPurchaseHistory:
  255. {
  256. data.enforceInterface(DESCRIPTOR);
  257. int _arg0;
  258. _arg0 = data.readInt();
  259. java.lang.String _arg1;
  260. _arg1 = data.readString();
  261. java.lang.String _arg2;
  262. _arg2 = data.readString();
  263. java.lang.String _arg3;
  264. _arg3 = data.readString();
  265. android.os.Bundle _arg4;
  266. if ((0!=data.readInt())) {
  267. _arg4 = android.os.Bundle.CREATOR.createFromParcel(data);
  268. }
  269. else {
  270. _arg4 = null;
  271. }
  272. android.os.Bundle _result = this.getPurchaseHistory(_arg0, _arg1, _arg2, _arg3, _arg4);
  273. reply.writeNoException();
  274. if ((_result!=null)) {
  275. reply.writeInt(1);
  276. _result.writeToParcel(reply, android.os.Parcelable.PARCELABLE_WRITE_RETURN_VALUE);
  277. }
  278. else {
  279. reply.writeInt(0);
  280. }
  281. return true;
  282. }
  283. case TRANSACTION_isBillingSupportedExtraParams:
  284. {
  285. data.enforceInterface(DESCRIPTOR);
  286. int _arg0;
  287. _arg0 = data.readInt();
  288. java.lang.String _arg1;
  289. _arg1 = data.readString();
  290. java.lang.String _arg2;
  291. _arg2 = data.readString();
  292. android.os.Bundle _arg3;
  293. if ((0!=data.readInt())) {
  294. _arg3 = android.os.Bundle.CREATOR.createFromParcel(data);
  295. }
  296. else {
  297. _arg3 = null;
  298. }
  299. int _result = this.isBillingSupportedExtraParams(_arg0, _arg1, _arg2, _arg3);
  300. reply.writeNoException();
  301. reply.writeInt(_result);
  302. return true;
  303. }
  304. }
  305. return super.onTransact(code, data, reply, flags);
  306. }
  307. private static class Proxy implements com.android.vending.billing.IInAppBillingService
  308. {
  309. private android.os.IBinder mRemote;
  310. Proxy(android.os.IBinder remote)
  311. {
  312. mRemote = remote;
  313. }
  314. @Override public android.os.IBinder asBinder()
  315. {
  316. return mRemote;
  317. }
  318. public java.lang.String getInterfaceDescriptor()
  319. {
  320. return DESCRIPTOR;
  321. }
  322. @Override public int isBillingSupported(int apiVersion, java.lang.String packageName, java.lang.String type) throws android.os.RemoteException
  323. {
  324. android.os.Parcel _data = android.os.Parcel.obtain();
  325. android.os.Parcel _reply = android.os.Parcel.obtain();
  326. int _result;
  327. try {
  328. _data.writeInterfaceToken(DESCRIPTOR);
  329. _data.writeInt(apiVersion);
  330. _data.writeString(packageName);
  331. _data.writeString(type);
  332. mRemote.transact(Stub.TRANSACTION_isBillingSupported, _data, _reply, 0);
  333. _reply.readException();
  334. _result = _reply.readInt();
  335. }
  336. finally {
  337. _reply.recycle();
  338. _data.recycle();
  339. }
  340. return _result;
  341. }
  342. /**
  343. * Provides details of a list of SKUs
  344. * Given a list of SKUs of a valid type in the skusBundle, this returns a bundle
  345. * with a list JSON strings containing the productId, price, title and description.
  346. * This API can be called with a maximum of 20 SKUs.
  347. * @param apiVersion billing API version that the app is using
  348. * @param packageName the package name of the calling app
  349. * @param type of the in-app items ("inapp" for one-time purchases
  350. * and "subs" for subscriptions)
  351. * @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST"
  352. * @return Bundle containing the following key-value pairs
  353. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
  354. * on failures.
  355. * "DETAILS_LIST" with a StringArrayList containing purchase information
  356. * in JSON format similar to:
  357. * '{ "productId" : "exampleSku",
  358. * "type" : "inapp",
  359. * "price" : "$5.00",
  360. * "price_currency": "USD",
  361. * "price_amount_micros": 5000000,
  362. * "title : "Example Title",
  363. * "description" : "This is an example description" }'
  364. */
  365. @Override public android.os.Bundle getSkuDetails(int apiVersion, java.lang.String packageName, java.lang.String type, android.os.Bundle skusBundle) throws android.os.RemoteException
  366. {
  367. android.os.Parcel _data = android.os.Parcel.obtain();
  368. android.os.Parcel _reply = android.os.Parcel.obtain();
  369. android.os.Bundle _result;
  370. try {
  371. _data.writeInterfaceToken(DESCRIPTOR);
  372. _data.writeInt(apiVersion);
  373. _data.writeString(packageName);
  374. _data.writeString(type);
  375. if ((skusBundle!=null)) {
  376. _data.writeInt(1);
  377. skusBundle.writeToParcel(_data, 0);
  378. }
  379. else {
  380. _data.writeInt(0);
  381. }
  382. mRemote.transact(Stub.TRANSACTION_getSkuDetails, _data, _reply, 0);
  383. _reply.readException();
  384. if ((0!=_reply.readInt())) {
  385. _result = android.os.Bundle.CREATOR.createFromParcel(_reply);
  386. }
  387. else {
  388. _result = null;
  389. }
  390. }
  391. finally {
  392. _reply.recycle();
  393. _data.recycle();
  394. }
  395. return _result;
  396. }
  397. /**
  398. * Returns a pending intent to launch the purchase flow for an in-app item by providing a SKU,
  399. * the type, a unique purchase token and an optional developer payload.
  400. * @param apiVersion billing API version that the app is using
  401. * @param packageName package name of the calling app
  402. * @param sku the SKU of the in-app item as published in the developer console
  403. * @param type of the in-app item being purchased ("inapp" for one-time purchases
  404. * and "subs" for subscriptions)
  405. * @param developerPayload optional argument to be sent back with the purchase information
  406. * @return Bundle containing the following key-value pairs
  407. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
  408. * on failures.
  409. * "BUY_INTENT" - PendingIntent to start the purchase flow
  410. *
  411. * The Pending intent should be launched with startIntentSenderForResult. When purchase flow
  412. * has completed, the onActivityResult() will give a resultCode of OK or CANCELED.
  413. * If the purchase is successful, the result data will contain the following key-value pairs
  414. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response
  415. * codes on failures.
  416. * "INAPP_PURCHASE_DATA" - String in JSON format similar to
  417. * '{"orderId":"12999763169054705758.1371079406387615",
  418. * "packageName":"com.example.app",
  419. * "productId":"exampleSku",
  420. * "purchaseTime":1345678900000,
  421. * "purchaseToken" : "122333444455555",
  422. * "developerPayload":"example developer payload" }'
  423. * "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that
  424. * was signed with the private key of the developer
  425. */
  426. @Override public android.os.Bundle getBuyIntent(int apiVersion, java.lang.String packageName, java.lang.String sku, java.lang.String type, java.lang.String developerPayload) throws android.os.RemoteException
  427. {
  428. android.os.Parcel _data = android.os.Parcel.obtain();
  429. android.os.Parcel _reply = android.os.Parcel.obtain();
  430. android.os.Bundle _result;
  431. try {
  432. _data.writeInterfaceToken(DESCRIPTOR);
  433. _data.writeInt(apiVersion);
  434. _data.writeString(packageName);
  435. _data.writeString(sku);
  436. _data.writeString(type);
  437. _data.writeString(developerPayload);
  438. mRemote.transact(Stub.TRANSACTION_getBuyIntent, _data, _reply, 0);
  439. _reply.readException();
  440. if ((0!=_reply.readInt())) {
  441. _result = android.os.Bundle.CREATOR.createFromParcel(_reply);
  442. }
  443. else {
  444. _result = null;
  445. }
  446. }
  447. finally {
  448. _reply.recycle();
  449. _data.recycle();
  450. }
  451. return _result;
  452. }
  453. /**
  454. * Returns the current SKUs owned by the user of the type and package name specified along with
  455. * purchase information and a signature of the data to be validated.
  456. * This will return all SKUs that have been purchased in V3 and managed items purchased using
  457. * V1 and V2 that have not been consumed.
  458. * @param apiVersion billing API version that the app is using
  459. * @param packageName package name of the calling app
  460. * @param type of the in-app items being requested ("inapp" for one-time purchases
  461. * and "subs" for subscriptions)
  462. * @param continuationToken to be set as null for the first call, if the number of owned
  463. * skus are too many, a continuationToken is returned in the response bundle.
  464. * This method can be called again with the continuation token to get the next set of
  465. * owned skus.
  466. * @return Bundle containing the following key-value pairs
  467. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
  468. on failures.
  469. * "INAPP_PURCHASE_ITEM_LIST" - StringArrayList containing the list of SKUs
  470. * "INAPP_PURCHASE_DATA_LIST" - StringArrayList containing the purchase information
  471. * "INAPP_DATA_SIGNATURE_LIST"- StringArrayList containing the signatures
  472. * of the purchase information
  473. * "INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the
  474. * next set of in-app purchases. Only set if the
  475. * user has more owned skus than the current list.
  476. */
  477. @Override public android.os.Bundle getPurchases(int apiVersion, java.lang.String packageName, java.lang.String type, java.lang.String continuationToken) throws android.os.RemoteException
  478. {
  479. android.os.Parcel _data = android.os.Parcel.obtain();
  480. android.os.Parcel _reply = android.os.Parcel.obtain();
  481. android.os.Bundle _result;
  482. try {
  483. _data.writeInterfaceToken(DESCRIPTOR);
  484. _data.writeInt(apiVersion);
  485. _data.writeString(packageName);
  486. _data.writeString(type);
  487. _data.writeString(continuationToken);
  488. mRemote.transact(Stub.TRANSACTION_getPurchases, _data, _reply, 0);
  489. _reply.readException();
  490. if ((0!=_reply.readInt())) {
  491. _result = android.os.Bundle.CREATOR.createFromParcel(_reply);
  492. }
  493. else {
  494. _result = null;
  495. }
  496. }
  497. finally {
  498. _reply.recycle();
  499. _data.recycle();
  500. }
  501. return _result;
  502. }
  503. @Override public int consumePurchase(int apiVersion, java.lang.String packageName, java.lang.String purchaseToken) throws android.os.RemoteException
  504. {
  505. android.os.Parcel _data = android.os.Parcel.obtain();
  506. android.os.Parcel _reply = android.os.Parcel.obtain();
  507. int _result;
  508. try {
  509. _data.writeInterfaceToken(DESCRIPTOR);
  510. _data.writeInt(apiVersion);
  511. _data.writeString(packageName);
  512. _data.writeString(purchaseToken);
  513. mRemote.transact(Stub.TRANSACTION_consumePurchase, _data, _reply, 0);
  514. _reply.readException();
  515. _result = _reply.readInt();
  516. }
  517. finally {
  518. _reply.recycle();
  519. _data.recycle();
  520. }
  521. return _result;
  522. }
  523. @Override public int stub(int apiVersion, java.lang.String packageName, java.lang.String type) throws android.os.RemoteException
  524. {
  525. android.os.Parcel _data = android.os.Parcel.obtain();
  526. android.os.Parcel _reply = android.os.Parcel.obtain();
  527. int _result;
  528. try {
  529. _data.writeInterfaceToken(DESCRIPTOR);
  530. _data.writeInt(apiVersion);
  531. _data.writeString(packageName);
  532. _data.writeString(type);
  533. mRemote.transact(Stub.TRANSACTION_stub, _data, _reply, 0);
  534. _reply.readException();
  535. _result = _reply.readInt();
  536. }
  537. finally {
  538. _reply.recycle();
  539. _data.recycle();
  540. }
  541. return _result;
  542. }
  543. /**
  544. * Returns a pending intent to launch the purchase flow for upgrading or downgrading a
  545. * subscription. The existing owned SKU(s) should be provided along with the new SKU that
  546. * the user is upgrading or downgrading to.
  547. * @param apiVersion billing API version that the app is using, must be 5 or later
  548. * @param packageName package name of the calling app
  549. * @param oldSkus the SKU(s) that the user is upgrading or downgrading from,
  550. * if null or empty this method will behave like {@link #getBuyIntent}
  551. * @param newSku the SKU that the user is upgrading or downgrading to
  552. * @param type of the item being purchased, currently must be "subs"
  553. * @param developerPayload optional argument to be sent back with the purchase information
  554. * @return Bundle containing the following key-value pairs
  555. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
  556. * on failures.
  557. * "BUY_INTENT" - PendingIntent to start the purchase flow
  558. *
  559. * The Pending intent should be launched with startIntentSenderForResult. When purchase flow
  560. * has completed, the onActivityResult() will give a resultCode of OK or CANCELED.
  561. * If the purchase is successful, the result data will contain the following key-value pairs
  562. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response
  563. * codes on failures.
  564. * "INAPP_PURCHASE_DATA" - String in JSON format similar to
  565. * '{"orderId":"12999763169054705758.1371079406387615",
  566. * "packageName":"com.example.app",
  567. * "productId":"exampleSku",
  568. * "purchaseTime":1345678900000,
  569. * "purchaseToken" : "122333444455555",
  570. * "developerPayload":"example developer payload" }'
  571. * "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that
  572. * was signed with the private key of the developer
  573. */
  574. @Override public android.os.Bundle getBuyIntentToReplaceSkus(int apiVersion, java.lang.String packageName, java.util.List<java.lang.String> oldSkus, java.lang.String newSku, java.lang.String type, java.lang.String developerPayload) throws android.os.RemoteException
  575. {
  576. android.os.Parcel _data = android.os.Parcel.obtain();
  577. android.os.Parcel _reply = android.os.Parcel.obtain();
  578. android.os.Bundle _result;
  579. try {
  580. _data.writeInterfaceToken(DESCRIPTOR);
  581. _data.writeInt(apiVersion);
  582. _data.writeString(packageName);
  583. _data.writeStringList(oldSkus);
  584. _data.writeString(newSku);
  585. _data.writeString(type);
  586. _data.writeString(developerPayload);
  587. mRemote.transact(Stub.TRANSACTION_getBuyIntentToReplaceSkus, _data, _reply, 0);
  588. _reply.readException();
  589. if ((0!=_reply.readInt())) {
  590. _result = android.os.Bundle.CREATOR.createFromParcel(_reply);
  591. }
  592. else {
  593. _result = null;
  594. }
  595. }
  596. finally {
  597. _reply.recycle();
  598. _data.recycle();
  599. }
  600. return _result;
  601. }
  602. /**
  603. * Returns a pending intent to launch the purchase flow for an in-app item. This method is
  604. * a variant of the {@link #getBuyIntent} method and takes an additional {@code extraParams}
  605. * parameter. This parameter is a Bundle of optional keys and values that affect the
  606. * operation of the method.
  607. * @param apiVersion billing API version that the app is using, must be 6 or later
  608. * @param packageName package name of the calling app
  609. * @param sku the SKU of the in-app item as published in the developer console
  610. * @param type of the in-app item being purchased ("inapp" for one-time purchases
  611. * and "subs" for subscriptions)
  612. * @param developerPayload optional argument to be sent back with the purchase information
  613. * @extraParams a Bundle with the following optional keys:
  614. * "skusToReplace" - List<String> - an optional list of SKUs that the user is
  615. * upgrading or downgrading from.
  616. * Pass this field if the purchase is upgrading or downgrading
  617. * existing subscriptions.
  618. * The specified SKUs are replaced with the SKUs that the user is
  619. * purchasing. Google Play replaces the specified SKUs at the start of
  620. * the next billing cycle.
  621. * "replaceSkusProration" - Boolean - whether the user should be credited for any unused
  622. * subscription time on the SKUs they are upgrading or downgrading.
  623. * If you set this field to true, Google Play swaps out the old SKUs
  624. * and credits the user with the unused value of their subscription
  625. * time on a pro-rated basis.
  626. * Google Play applies this credit to the new subscription, and does
  627. * not begin billing the user for the new subscription until after
  628. * the credit is used up.
  629. * If you set this field to false, the user does not receive credit for
  630. * any unused subscription time and the recurrence date does not
  631. * change.
  632. * Default value is true. Ignored if you do not pass skusToReplace.
  633. * "accountId" - String - an optional obfuscated string that is uniquely
  634. * associated with the user's account in your app.
  635. * If you pass this value, Google Play can use it to detect irregular
  636. * activity, such as many devices making purchases on the same
  637. * account in a short period of time.
  638. * Do not use the developer ID or the user's Google ID for this field.
  639. * In addition, this field should not contain the user's ID in
  640. * cleartext.
  641. * We recommend that you use a one-way hash to generate a string from
  642. * the user's ID, and store the hashed string in this field.
  643. * "vr" - Boolean - an optional flag indicating whether the returned intent
  644. * should start a VR purchase flow. The apiVersion must also be 7 or
  645. * later to use this flag.
  646. */
  647. @Override public android.os.Bundle getBuyIntentExtraParams(int apiVersion, java.lang.String packageName, java.lang.String sku, java.lang.String type, java.lang.String developerPayload, android.os.Bundle extraParams) throws android.os.RemoteException
  648. {
  649. android.os.Parcel _data = android.os.Parcel.obtain();
  650. android.os.Parcel _reply = android.os.Parcel.obtain();
  651. android.os.Bundle _result;
  652. try {
  653. _data.writeInterfaceToken(DESCRIPTOR);
  654. _data.writeInt(apiVersion);
  655. _data.writeString(packageName);
  656. _data.writeString(sku);
  657. _data.writeString(type);
  658. _data.writeString(developerPayload);
  659. if ((extraParams!=null)) {
  660. _data.writeInt(1);
  661. extraParams.writeToParcel(_data, 0);
  662. }
  663. else {
  664. _data.writeInt(0);
  665. }
  666. mRemote.transact(Stub.TRANSACTION_getBuyIntentExtraParams, _data, _reply, 0);
  667. _reply.readException();
  668. if ((0!=_reply.readInt())) {
  669. _result = android.os.Bundle.CREATOR.createFromParcel(_reply);
  670. }
  671. else {
  672. _result = null;
  673. }
  674. }
  675. finally {
  676. _reply.recycle();
  677. _data.recycle();
  678. }
  679. return _result;
  680. }
  681. /**
  682. * Returns the most recent purchase made by the user for each SKU, even if that purchase is
  683. * expired, canceled, or consumed.
  684. * @param apiVersion billing API version that the app is using, must be 6 or later
  685. * @param packageName package name of the calling app
  686. * @param type of the in-app items being requested ("inapp" for one-time purchases
  687. * and "subs" for subscriptions)
  688. * @param continuationToken to be set as null for the first call, if the number of owned
  689. * skus is too large, a continuationToken is returned in the response bundle.
  690. * This method can be called again with the continuation token to get the next set of
  691. * owned skus.
  692. * @param extraParams a Bundle with extra params that would be appended into http request
  693. * query string. Not used at this moment. Reserved for future functionality.
  694. * @return Bundle containing the following key-value pairs
  695. * "RESPONSE_CODE" with int value: RESULT_OK(0) if success,
  696. * {@link IabHelper#BILLING_RESPONSE_RESULT_*} response codes on failures.
  697. *
  698. * "INAPP_PURCHASE_ITEM_LIST" - ArrayList<String> containing the list of SKUs
  699. * "INAPP_PURCHASE_DATA_LIST" - ArrayList<String> containing the purchase information
  700. * "INAPP_DATA_SIGNATURE_LIST"- ArrayList<String> containing the signatures
  701. * of the purchase information
  702. * "INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the
  703. * next set of in-app purchases. Only set if the
  704. * user has more owned skus than the current list.
  705. */
  706. @Override public android.os.Bundle getPurchaseHistory(int apiVersion, java.lang.String packageName, java.lang.String type, java.lang.String continuationToken, android.os.Bundle extraParams) throws android.os.RemoteException
  707. {
  708. android.os.Parcel _data = android.os.Parcel.obtain();
  709. android.os.Parcel _reply = android.os.Parcel.obtain();
  710. android.os.Bundle _result;
  711. try {
  712. _data.writeInterfaceToken(DESCRIPTOR);
  713. _data.writeInt(apiVersion);
  714. _data.writeString(packageName);
  715. _data.writeString(type);
  716. _data.writeString(continuationToken);
  717. if ((extraParams!=null)) {
  718. _data.writeInt(1);
  719. extraParams.writeToParcel(_data, 0);
  720. }
  721. else {
  722. _data.writeInt(0);
  723. }
  724. mRemote.transact(Stub.TRANSACTION_getPurchaseHistory, _data, _reply, 0);
  725. _reply.readException();
  726. if ((0!=_reply.readInt())) {
  727. _result = android.os.Bundle.CREATOR.createFromParcel(_reply);
  728. }
  729. else {
  730. _result = null;
  731. }
  732. }
  733. finally {
  734. _reply.recycle();
  735. _data.recycle();
  736. }
  737. return _result;
  738. }
  739. @Override public int isBillingSupportedExtraParams(int apiVersion, java.lang.String packageName, java.lang.String type, android.os.Bundle extraParams) throws android.os.RemoteException
  740. {
  741. android.os.Parcel _data = android.os.Parcel.obtain();
  742. android.os.Parcel _reply = android.os.Parcel.obtain();
  743. int _result;
  744. try {
  745. _data.writeInterfaceToken(DESCRIPTOR);
  746. _data.writeInt(apiVersion);
  747. _data.writeString(packageName);
  748. _data.writeString(type);
  749. if ((extraParams!=null)) {
  750. _data.writeInt(1);
  751. extraParams.writeToParcel(_data, 0);
  752. }
  753. else {
  754. _data.writeInt(0);
  755. }
  756. mRemote.transact(Stub.TRANSACTION_isBillingSupportedExtraParams, _data, _reply, 0);
  757. _reply.readException();
  758. _result = _reply.readInt();
  759. }
  760. finally {
  761. _reply.recycle();
  762. _data.recycle();
  763. }
  764. return _result;
  765. }
  766. }
  767. static final int TRANSACTION_isBillingSupported = (android.os.IBinder.FIRST_CALL_TRANSACTION + 0);
  768. static final int TRANSACTION_getSkuDetails = (android.os.IBinder.FIRST_CALL_TRANSACTION + 1);
  769. static final int TRANSACTION_getBuyIntent = (android.os.IBinder.FIRST_CALL_TRANSACTION + 2);
  770. static final int TRANSACTION_getPurchases = (android.os.IBinder.FIRST_CALL_TRANSACTION + 3);
  771. static final int TRANSACTION_consumePurchase = (android.os.IBinder.FIRST_CALL_TRANSACTION + 4);
  772. static final int TRANSACTION_stub = (android.os.IBinder.FIRST_CALL_TRANSACTION + 5);
  773. static final int TRANSACTION_getBuyIntentToReplaceSkus = (android.os.IBinder.FIRST_CALL_TRANSACTION + 6);
  774. static final int TRANSACTION_getBuyIntentExtraParams = (android.os.IBinder.FIRST_CALL_TRANSACTION + 7);
  775. static final int TRANSACTION_getPurchaseHistory = (android.os.IBinder.FIRST_CALL_TRANSACTION + 8);
  776. static final int TRANSACTION_isBillingSupportedExtraParams = (android.os.IBinder.FIRST_CALL_TRANSACTION + 9);
  777. }
  778. public int isBillingSupported(int apiVersion, java.lang.String packageName, java.lang.String type) throws android.os.RemoteException;
  779. /**
  780. * Provides details of a list of SKUs
  781. * Given a list of SKUs of a valid type in the skusBundle, this returns a bundle
  782. * with a list JSON strings containing the productId, price, title and description.
  783. * This API can be called with a maximum of 20 SKUs.
  784. * @param apiVersion billing API version that the app is using
  785. * @param packageName the package name of the calling app
  786. * @param type of the in-app items ("inapp" for one-time purchases
  787. * and "subs" for subscriptions)
  788. * @param skusBundle bundle containing a StringArrayList of SKUs with key "ITEM_ID_LIST"
  789. * @return Bundle containing the following key-value pairs
  790. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
  791. * on failures.
  792. * "DETAILS_LIST" with a StringArrayList containing purchase information
  793. * in JSON format similar to:
  794. * '{ "productId" : "exampleSku",
  795. * "type" : "inapp",
  796. * "price" : "$5.00",
  797. * "price_currency": "USD",
  798. * "price_amount_micros": 5000000,
  799. * "title : "Example Title",
  800. * "description" : "This is an example description" }'
  801. */
  802. public android.os.Bundle getSkuDetails(int apiVersion, java.lang.String packageName, java.lang.String type, android.os.Bundle skusBundle) throws android.os.RemoteException;
  803. /**
  804. * Returns a pending intent to launch the purchase flow for an in-app item by providing a SKU,
  805. * the type, a unique purchase token and an optional developer payload.
  806. * @param apiVersion billing API version that the app is using
  807. * @param packageName package name of the calling app
  808. * @param sku the SKU of the in-app item as published in the developer console
  809. * @param type of the in-app item being purchased ("inapp" for one-time purchases
  810. * and "subs" for subscriptions)
  811. * @param developerPayload optional argument to be sent back with the purchase information
  812. * @return Bundle containing the following key-value pairs
  813. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
  814. * on failures.
  815. * "BUY_INTENT" - PendingIntent to start the purchase flow
  816. *
  817. * The Pending intent should be launched with startIntentSenderForResult. When purchase flow
  818. * has completed, the onActivityResult() will give a resultCode of OK or CANCELED.
  819. * If the purchase is successful, the result data will contain the following key-value pairs
  820. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response
  821. * codes on failures.
  822. * "INAPP_PURCHASE_DATA" - String in JSON format similar to
  823. * '{"orderId":"12999763169054705758.1371079406387615",
  824. * "packageName":"com.example.app",
  825. * "productId":"exampleSku",
  826. * "purchaseTime":1345678900000,
  827. * "purchaseToken" : "122333444455555",
  828. * "developerPayload":"example developer payload" }'
  829. * "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that
  830. * was signed with the private key of the developer
  831. */
  832. public android.os.Bundle getBuyIntent(int apiVersion, java.lang.String packageName, java.lang.String sku, java.lang.String type, java.lang.String developerPayload) throws android.os.RemoteException;
  833. /**
  834. * Returns the current SKUs owned by the user of the type and package name specified along with
  835. * purchase information and a signature of the data to be validated.
  836. * This will return all SKUs that have been purchased in V3 and managed items purchased using
  837. * V1 and V2 that have not been consumed.
  838. * @param apiVersion billing API version that the app is using
  839. * @param packageName package name of the calling app
  840. * @param type of the in-app items being requested ("inapp" for one-time purchases
  841. * and "subs" for subscriptions)
  842. * @param continuationToken to be set as null for the first call, if the number of owned
  843. * skus are too many, a continuationToken is returned in the response bundle.
  844. * This method can be called again with the continuation token to get the next set of
  845. * owned skus.
  846. * @return Bundle containing the following key-value pairs
  847. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
  848. on failures.
  849. * "INAPP_PURCHASE_ITEM_LIST" - StringArrayList containing the list of SKUs
  850. * "INAPP_PURCHASE_DATA_LIST" - StringArrayList containing the purchase information
  851. * "INAPP_DATA_SIGNATURE_LIST"- StringArrayList containing the signatures
  852. * of the purchase information
  853. * "INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the
  854. * next set of in-app purchases. Only set if the
  855. * user has more owned skus than the current list.
  856. */
  857. public android.os.Bundle getPurchases(int apiVersion, java.lang.String packageName, java.lang.String type, java.lang.String continuationToken) throws android.os.RemoteException;
  858. public int consumePurchase(int apiVersion, java.lang.String packageName, java.lang.String purchaseToken) throws android.os.RemoteException;
  859. public int stub(int apiVersion, java.lang.String packageName, java.lang.String type) throws android.os.RemoteException;
  860. /**
  861. * Returns a pending intent to launch the purchase flow for upgrading or downgrading a
  862. * subscription. The existing owned SKU(s) should be provided along with the new SKU that
  863. * the user is upgrading or downgrading to.
  864. * @param apiVersion billing API version that the app is using, must be 5 or later
  865. * @param packageName package name of the calling app
  866. * @param oldSkus the SKU(s) that the user is upgrading or downgrading from,
  867. * if null or empty this method will behave like {@link #getBuyIntent}
  868. * @param newSku the SKU that the user is upgrading or downgrading to
  869. * @param type of the item being purchased, currently must be "subs"
  870. * @param developerPayload optional argument to be sent back with the purchase information
  871. * @return Bundle containing the following key-value pairs
  872. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response codes
  873. * on failures.
  874. * "BUY_INTENT" - PendingIntent to start the purchase flow
  875. *
  876. * The Pending intent should be launched with startIntentSenderForResult. When purchase flow
  877. * has completed, the onActivityResult() will give a resultCode of OK or CANCELED.
  878. * If the purchase is successful, the result data will contain the following key-value pairs
  879. * "RESPONSE_CODE" with int value, RESULT_OK(0) if success, appropriate response
  880. * codes on failures.
  881. * "INAPP_PURCHASE_DATA" - String in JSON format similar to
  882. * '{"orderId":"12999763169054705758.1371079406387615",
  883. * "packageName":"com.example.app",
  884. * "productId":"exampleSku",
  885. * "purchaseTime":1345678900000,
  886. * "purchaseToken" : "122333444455555",
  887. * "developerPayload":"example developer payload" }'
  888. * "INAPP_DATA_SIGNATURE" - String containing the signature of the purchase data that
  889. * was signed with the private key of the developer
  890. */
  891. public android.os.Bundle getBuyIntentToReplaceSkus(int apiVersion, java.lang.String packageName, java.util.List<java.lang.String> oldSkus, java.lang.String newSku, java.lang.String type, java.lang.String developerPayload) throws android.os.RemoteException;
  892. /**
  893. * Returns a pending intent to launch the purchase flow for an in-app item. This method is
  894. * a variant of the {@link #getBuyIntent} method and takes an additional {@code extraParams}
  895. * parameter. This parameter is a Bundle of optional keys and values that affect the
  896. * operation of the method.
  897. * @param apiVersion billing API version that the app is using, must be 6 or later
  898. * @param packageName package name of the calling app
  899. * @param sku the SKU of the in-app item as published in the developer console
  900. * @param type of the in-app item being purchased ("inapp" for one-time purchases
  901. * and "subs" for subscriptions)
  902. * @param developerPayload optional argument to be sent back with the purchase information
  903. * @extraParams a Bundle with the following optional keys:
  904. * "skusToReplace" - List<String> - an optional list of SKUs that the user is
  905. * upgrading or downgrading from.
  906. * Pass this field if the purchase is upgrading or downgrading
  907. * existing subscriptions.
  908. * The specified SKUs are replaced with the SKUs that the user is
  909. * purchasing. Google Play replaces the specified SKUs at the start of
  910. * the next billing cycle.
  911. * "replaceSkusProration" - Boolean - whether the user should be credited for any unused
  912. * subscription time on the SKUs they are upgrading or downgrading.
  913. * If you set this field to true, Google Play swaps out the old SKUs
  914. * and credits the user with the unused value of their subscription
  915. * time on a pro-rated basis.
  916. * Google Play applies this credit to the new subscription, and does
  917. * not begin billing the user for the new subscription until after
  918. * the credit is used up.
  919. * If you set this field to false, the user does not receive credit for
  920. * any unused subscription time and the recurrence date does not
  921. * change.
  922. * Default value is true. Ignored if you do not pass skusToReplace.
  923. * "accountId" - String - an optional obfuscated string that is uniquely
  924. * associated with the user's account in your app.
  925. * If you pass this value, Google Play can use it to detect irregular
  926. * activity, such as many devices making purchases on the same
  927. * account in a short period of time.
  928. * Do not use the developer ID or the user's Google ID for this field.
  929. * In addition, this field should not contain the user's ID in
  930. * cleartext.
  931. * We recommend that you use a one-way hash to generate a string from
  932. * the user's ID, and store the hashed string in this field.
  933. * "vr" - Boolean - an optional flag indicating whether the returned intent
  934. * should start a VR purchase flow. The apiVersion must also be 7 or
  935. * later to use this flag.
  936. */
  937. public android.os.Bundle getBuyIntentExtraParams(int apiVersion, java.lang.String packageName, java.lang.String sku, java.lang.String type, java.lang.String developerPayload, android.os.Bundle extraParams) throws android.os.RemoteException;
  938. /**
  939. * Returns the most recent purchase made by the user for each SKU, even if that purchase is
  940. * expired, canceled, or consumed.
  941. * @param apiVersion billing API version that the app is using, must be 6 or later
  942. * @param packageName package name of the calling app
  943. * @param type of the in-app items being requested ("inapp" for one-time purchases
  944. * and "subs" for subscriptions)
  945. * @param continuationToken to be set as null for the first call, if the number of owned
  946. * skus is too large, a continuationToken is returned in the response bundle.
  947. * This method can be called again with the continuation token to get the next set of
  948. * owned skus.
  949. * @param extraParams a Bundle with extra params that would be appended into http request
  950. * query string. Not used at this moment. Reserved for future functionality.
  951. * @return Bundle containing the following key-value pairs
  952. * "RESPONSE_CODE" with int value: RESULT_OK(0) if success,
  953. * {@link IabHelper#BILLING_RESPONSE_RESULT_*} response codes on failures.
  954. *
  955. * "INAPP_PURCHASE_ITEM_LIST" - ArrayList<String> containing the list of SKUs
  956. * "INAPP_PURCHASE_DATA_LIST" - ArrayList<String> containing the purchase information
  957. * "INAPP_DATA_SIGNATURE_LIST"- ArrayList<String> containing the signatures
  958. * of the purchase information
  959. * "INAPP_CONTINUATION_TOKEN" - String containing a continuation token for the
  960. * next set of in-app purchases. Only set if the
  961. * user has more owned skus than the current list.
  962. */
  963. public android.os.Bundle getPurchaseHistory(int apiVersion, java.lang.String packageName, java.lang.String type, java.lang.String continuationToken, android.os.Bundle extraParams) throws android.os.RemoteException;
  964. public int isBillingSupportedExtraParams(int apiVersion, java.lang.String packageName, java.lang.String type, android.os.Bundle extraParams) throws android.os.RemoteException;
  965. }