Difference between revisions of "GoogleBilling"

From GiderosMobile
Line 4: Line 4:
 
=== Description ===
 
=== Description ===
 
<translate><br />
 
<translate><br />
The [[GoogleBilling]] class is defined in the module &quot;googlebilling&quot;. Therefore, you need to call<br />
+
The [[Special:MyLanguage/GoogleBilling|GoogleBilling]] class is defined in the module &quot;googlebilling&quot;. Therefore, you need to call<br />
[[require(&quot;googlebilling&quot;)]] before using it. Loading the Google Billing module <br />
+
[[Special:MyLanguage/require(&quot;googlebilling&quot;)|require(&quot;googlebilling&quot;)]] before using it. Loading the Google Billing module <br />
also creates a global variable [[googlebilling]] of type [[GoogleBilling]] for direct use. <br />
+
also creates a global variable [[Special:MyLanguage/googlebilling|googlebilling]] of type [[Special:MyLanguage/GoogleBilling|GoogleBilling]] for direct use. <br />
 
  <br />
 
  <br />
 
&lt;h3&gt;GoogleBilling Events and Response Codes&lt;/h3&gt;<br />
 
&lt;h3&gt;GoogleBilling Events and Response Codes&lt;/h3&gt;<br />
 
<br />
 
<br />
[[GoogleBilling]] class dispatches 5 events: [[Event.CHECK_BILLING_SUPPORTED_COMPLETE]],<br />
+
[[Special:MyLanguage/GoogleBilling|GoogleBilling]] class dispatches 5 events: [[Special:MyLanguage/Event.CHECK_BILLING_SUPPORTED_COMPLETE|Event.CHECK_BILLING_SUPPORTED_COMPLETE]],<br />
[[Event.REQUEST_PURCHASE_COMPLETE]],[[Event.RESTORE_TRANSACTIONS_COMPLETE]],<br />
+
[[Special:MyLanguage/Event.REQUEST_PURCHASE_COMPLETE|Event.REQUEST_PURCHASE_COMPLETE]],[[Special:MyLanguage/Event.RESTORE_TRANSACTIONS_COMPLETE|Event.RESTORE_TRANSACTIONS_COMPLETE]],<br />
[[Event.CONFIRM_NOTIFICATION_COMPLETE]] and [[Event.PURCHASE_STATE_CHANGE]].<br />
+
[[Special:MyLanguage/Event.CONFIRM_NOTIFICATION_COMPLETE|Event.CONFIRM_NOTIFICATION_COMPLETE]] and [[Special:MyLanguage/Event.PURCHASE_STATE_CHANGE|Event.PURCHASE_STATE_CHANGE]].<br />
 
<br />
 
<br />
[[Event.*_COMPLETE]] events contains a field [[event.responseCode]] which provides status information <br />
+
[[Special:MyLanguage/Event.*_COMPLETE|Event.*_COMPLETE]] events contains a field [[Special:MyLanguage/event.responseCode|event.responseCode]] which provides status information <br />
 
and error information about a request. Response code can be one of these values:<br />
 
and error information about a request. Response code can be one of these values:<br />
 
<br />
 
<br />
 
&lt;ul&gt;<br />
 
&lt;ul&gt;<br />
&lt;li&gt;[[GoogleBilling.OK]]: Indicates that the request was sent to the server successfully. When this code is returned&lt;/li&gt;<br />
+
&lt;li&gt;[[Special:MyLanguage/GoogleBilling.OK|GoogleBilling.OK]]: Indicates that the request was sent to the server successfully. When this code is returned&lt;/li&gt;<br />
 
&lt;/ul&gt;<br />
 
&lt;/ul&gt;<br />
in response to a [[checkBillingSupported]] function, indicates that billing is supported.<br />
+
in response to a [[Special:MyLanguage/checkBillingSupported|checkBillingSupported]] function, indicates that billing is supported.<br />
 
&lt;ul&gt;<br />
 
&lt;ul&gt;<br />
&lt;li&gt;[[GoogleBilling.USER_CANCELED]]: Indicates that the user pressed the back button on the checkout page instead of buying the item.&lt;/li&gt;<br />
+
&lt;li&gt;[[Special:MyLanguage/GoogleBilling.USER_CANCELED|GoogleBilling.USER_CANCELED]]: Indicates that the user pressed the back button on the checkout page instead of buying the item.&lt;/li&gt;<br />
&lt;li&gt;[[GoogleBilling.SERVICE_UNAVAILABLE]]: Indicates that the network connection is down.&lt;/li&gt;<br />
+
&lt;li&gt;[[Special:MyLanguage/GoogleBilling.SERVICE_UNAVAILABLE|GoogleBilling.SERVICE_UNAVAILABLE]]: Indicates that the network connection is down.&lt;/li&gt;<br />
&lt;li&gt;[[GoogleBilling.BILLING_UNAVAILABLE]]: Indicates that in-app billing is not available because the API version that&lt;/li&gt;<br />
+
&lt;li&gt;[[Special:MyLanguage/GoogleBilling.BILLING_UNAVAILABLE|GoogleBilling.BILLING_UNAVAILABLE]]: Indicates that in-app billing is not available because the API version that&lt;/li&gt;<br />
 
&lt;/ul&gt;<br />
 
&lt;/ul&gt;<br />
 
you specified is not recognized by the Google Play application or the user is ineligible for in-app billing <br />
 
you specified is not recognized by the Google Play application or the user is ineligible for in-app billing <br />
 
(for example, the user resides in a country that prohibits in-app purchases).<br />
 
(for example, the user resides in a country that prohibits in-app purchases).<br />
 
&lt;ul&gt;<br />
 
&lt;ul&gt;<br />
&lt;li&gt;[[GoogleBilling.ITEM_UNAVAILABLE]]: Indicates that Google Play cannot find the requested item in the application&#039;s product list.&lt;/li&gt;<br />
+
&lt;li&gt;[[Special:MyLanguage/GoogleBilling.ITEM_UNAVAILABLE|GoogleBilling.ITEM_UNAVAILABLE]]: Indicates that Google Play cannot find the requested item in the application&#039;s product list.&lt;/li&gt;<br />
 
&lt;/ul&gt;<br />
 
&lt;/ul&gt;<br />
This can happen if the product ID is misspelled in your [[requestPurchase]] function or if an item is unpublished in the application&#039;s product list.<br />
+
This can happen if the product ID is misspelled in your [[Special:MyLanguage/requestPurchase|requestPurchase]] function or if an item is unpublished in the application&#039;s product list.<br />
 
&lt;ul&gt;<br />
 
&lt;ul&gt;<br />
&lt;li&gt;[[GoogleBilling.DEVELOPER_ERROR]]: Indicates that an application is trying to make an in-app billing request but the application has not declared the&lt;/li&gt;<br />
+
&lt;li&gt;[[Special:MyLanguage/GoogleBilling.DEVELOPER_ERROR|GoogleBilling.DEVELOPER_ERROR]]: Indicates that an application is trying to make an in-app billing request but the application has not declared the&lt;/li&gt;<br />
 
&lt;/ul&gt;<br />
 
&lt;/ul&gt;<br />
 
com.android.vending.BILLING permission in its manifest. Can also indicate that an application is not properly signed, <br />
 
com.android.vending.BILLING permission in its manifest. Can also indicate that an application is not properly signed, <br />
 
or that you sent a malformed request, such as a request with missing Bundle keys or a request that uses an unrecognized request type.<br />
 
or that you sent a malformed request, such as a request with missing Bundle keys or a request that uses an unrecognized request type.<br />
 
&lt;ul&gt;<br />
 
&lt;ul&gt;<br />
&lt;li&gt;[[GoogleBilling.ERROR]]: Indicates an unexpected server error. For example, this error is triggered if you try to purchase an item from yourself, which is not allowed by Google Wallet.&lt;/li&gt;<br />
+
&lt;li&gt;[[Special:MyLanguage/GoogleBilling.ERROR|GoogleBilling.ERROR]]: Indicates an unexpected server error. For example, this error is triggered if you try to purchase an item from yourself, which is not allowed by Google Wallet.&lt;/li&gt;<br />
 
&lt;/ul&gt;<br />
 
&lt;/ul&gt;<br />
 
<br />
 
<br />
 
&lt;h3&gt;# Event.CHECK_BILLING_SUPPORTED_COMPLETE&lt;/h3&gt;<br />
 
&lt;h3&gt;# Event.CHECK_BILLING_SUPPORTED_COMPLETE&lt;/h3&gt;<br />
Dispatched when [[checkBillingSuported]] function completes. It contains [[event.responseCode]] and [[event.productType]] fields.<br />
+
Dispatched when [[Special:MyLanguage/checkBillingSuported|checkBillingSuported]] function completes. It contains [[Special:MyLanguage/event.responseCode|event.responseCode]] and [[Special:MyLanguage/event.productType|event.productType]] fields.<br />
 
<br />
 
<br />
 
&lt;h3&gt;# Event.REQUEST_PURCHASE_COMPLETE&lt;/h3&gt;<br />
 
&lt;h3&gt;# Event.REQUEST_PURCHASE_COMPLETE&lt;/h3&gt;<br />
Dispatched when [[requestPurchase]] function completes. It contains [[event.responseCode]], [[event.productId]], [[event.productType]] and [[event.developerPayload]] fields.<br />
+
Dispatched when [[Special:MyLanguage/requestPurchase|requestPurchase]] function completes. It contains [[Special:MyLanguage/event.responseCode|event.responseCode]], [[Special:MyLanguage/event.productId|event.productId]], [[Special:MyLanguage/event.productType|event.productType]] and [[Special:MyLanguage/event.developerPayload|event.developerPayload]] fields.<br />
 
<br />
 
<br />
 
&lt;h3&gt;# Event.RESTORE_TRANSACTIONS_COMPLETE&lt;/h3&gt;<br />
 
&lt;h3&gt;# Event.RESTORE_TRANSACTIONS_COMPLETE&lt;/h3&gt;<br />
Dispatched when [[restoreTransactions]] function completes. It contains [[event.responseCode]] fields.<br />
+
Dispatched when [[Special:MyLanguage/restoreTransactions|restoreTransactions]] function completes. It contains [[Special:MyLanguage/event.responseCode|event.responseCode]] fields.<br />
 
<br />
 
<br />
 
&lt;h3&gt;# Event.CONFIRM_NOTIFICATION_COMPLETE&lt;/h3&gt;<br />
 
&lt;h3&gt;# Event.CONFIRM_NOTIFICATION_COMPLETE&lt;/h3&gt;<br />
Dispatched when [[confirmNotification]] function completes. It contains [[event.responseCode]] and [[event.notificationId]] fields.<br />
+
Dispatched when [[Special:MyLanguage/confirmNotification|confirmNotification]] function completes. It contains [[Special:MyLanguage/event.responseCode|event.responseCode]] and [[Special:MyLanguage/event.notificationId|event.notificationId]] fields.<br />
 
<br />
 
<br />
 
&lt;h3&gt;# Event.PURCHASE_STATE_CHANGE&lt;/h3&gt;<br />
 
&lt;h3&gt;# Event.PURCHASE_STATE_CHANGE&lt;/h3&gt;<br />
Dispatched when information about a transaction is received. It contains [[event.purchaseState]], [[event.productId]], [[event.notificationId]], [[event.purchaseTime]] and [[event.developerPayload]] fields.<br />
+
Dispatched when information about a transaction is received. It contains [[Special:MyLanguage/event.purchaseState|event.purchaseState]], [[Special:MyLanguage/event.productId|event.productId]], [[Special:MyLanguage/event.notificationId|event.notificationId]], [[Special:MyLanguage/event.purchaseTime|event.purchaseTime]] and [[Special:MyLanguage/event.developerPayload|event.developerPayload]] fields.<br />
 
<br /></translate>
 
<br /></translate>
 
{|-
 
{|-
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== Methods ===
 
=== Methods ===
[[GoogleBilling:checkBillingSupported]] <br/>
+
[[Special:MyLanguage/GoogleBilling:checkBillingSupported|GoogleBilling:checkBillingSupported]] <br/>
[[GoogleBilling:confirmNotification]] <br/>
+
[[Special:MyLanguage/GoogleBilling:confirmNotification|GoogleBilling:confirmNotification]] <br/>
[[GoogleBilling:requestPurchase]] <br/>
+
[[Special:MyLanguage/GoogleBilling:requestPurchase|GoogleBilling:requestPurchase]] <br/>
[[GoogleBilling:restoreTransactions]] <br/>
+
[[Special:MyLanguage/GoogleBilling:restoreTransactions|GoogleBilling:restoreTransactions]] <br/>
[[GoogleBilling:setApiVersion]] <br/>
+
[[Special:MyLanguage/GoogleBilling:setApiVersion|GoogleBilling:setApiVersion]] <br/>
[[GoogleBilling:setPublicKey]] <br/>
+
[[Special:MyLanguage/GoogleBilling:setPublicKey|GoogleBilling:setPublicKey]] <br/>
 
| style="width: 50%; vertical-align:top;"|
 
| style="width: 50%; vertical-align:top;"|
 
=== Events ===
 
=== Events ===
[[Event.CHECK_BILLING_SUPPORTED_COMPLETE]]<br/>
+
[[Special:MyLanguage/Event.CHECK_BILLING_SUPPORTED_COMPLETE|Event.CHECK_BILLING_SUPPORTED_COMPLETE]]<br/>
[[Event.CONFIRM_NOTIFICATION_COMPLETE]]<br/>
+
[[Special:MyLanguage/Event.CONFIRM_NOTIFICATION_COMPLETE|Event.CONFIRM_NOTIFICATION_COMPLETE]]<br/>
[[Event.PURCHASE_STATE_CHANGE]]<br/>
+
[[Special:MyLanguage/Event.PURCHASE_STATE_CHANGE|Event.PURCHASE_STATE_CHANGE]]<br/>
[[Event.REQUEST_PURCHASE_COMPLETE]]<br/>
+
[[Special:MyLanguage/Event.REQUEST_PURCHASE_COMPLETE|Event.REQUEST_PURCHASE_COMPLETE]]<br/>
[[Event.RESTORE_TRANSACTIONS_COMPLETE]]<br/>
+
[[Special:MyLanguage/Event.RESTORE_TRANSACTIONS_COMPLETE|Event.RESTORE_TRANSACTIONS_COMPLETE]]<br/>
 
=== Constants ===
 
=== Constants ===
[[GoogleBilling.BILLING_UNAVAILABLE]]<br/>
+
[[Special:MyLanguage/GoogleBilling.BILLING_UNAVAILABLE|GoogleBilling.BILLING_UNAVAILABLE]]<br/>
[[GoogleBilling.CANCELED]]<br/>
+
[[Special:MyLanguage/GoogleBilling.CANCELED|GoogleBilling.CANCELED]]<br/>
[[GoogleBilling.DEVELOPER_ERROR]]<br/>
+
[[Special:MyLanguage/GoogleBilling.DEVELOPER_ERROR|GoogleBilling.DEVELOPER_ERROR]]<br/>
[[GoogleBilling.ERROR]]<br/>
+
[[Special:MyLanguage/GoogleBilling.ERROR|GoogleBilling.ERROR]]<br/>
[[GoogleBilling.EXPIRED]]<br/>
+
[[Special:MyLanguage/GoogleBilling.EXPIRED|GoogleBilling.EXPIRED]]<br/>
[[GoogleBilling.INAPP]]<br/>
+
[[Special:MyLanguage/GoogleBilling.INAPP|GoogleBilling.INAPP]]<br/>
[[GoogleBilling.ITEM_UNAVAILABLE]]<br/>
+
[[Special:MyLanguage/GoogleBilling.ITEM_UNAVAILABLE|GoogleBilling.ITEM_UNAVAILABLE]]<br/>
[[GoogleBilling.OK]]<br/>
+
[[Special:MyLanguage/GoogleBilling.OK|GoogleBilling.OK]]<br/>
[[GoogleBilling.PURCHASED]]<br/>
+
[[Special:MyLanguage/GoogleBilling.PURCHASED|GoogleBilling.PURCHASED]]<br/>
[[GoogleBilling.REFUNDED]]<br/>
+
[[Special:MyLanguage/GoogleBilling.REFUNDED|GoogleBilling.REFUNDED]]<br/>
[[GoogleBilling.SERVICE_UNAVAILABLE]]<br/>
+
[[Special:MyLanguage/GoogleBilling.SERVICE_UNAVAILABLE|GoogleBilling.SERVICE_UNAVAILABLE]]<br/>
[[GoogleBilling.SUBS]]<br/>
+
[[Special:MyLanguage/GoogleBilling.SUBS|GoogleBilling.SUBS]]<br/>
[[GoogleBilling.USER_CANCELED]]<br/>
+
[[Special:MyLanguage/GoogleBilling.USER_CANCELED|GoogleBilling.USER_CANCELED]]<br/>
 
|}
 
|}

Revision as of 17:34, 23 August 2018

Supported platforms: android
Available since: Gideros 2012.09

Description


The GoogleBilling class is defined in the module "googlebilling". Therefore, you need to call
require("googlebilling") before using it. Loading the Google Billing module
also creates a global variable googlebilling of type GoogleBilling for direct use.


<h3>GoogleBilling Events and Response Codes</h3>

GoogleBilling class dispatches 5 events: Event.CHECK_BILLING_SUPPORTED_COMPLETE,
Event.REQUEST_PURCHASE_COMPLETE,Event.RESTORE_TRANSACTIONS_COMPLETE,
Event.CONFIRM_NOTIFICATION_COMPLETE and Event.PURCHASE_STATE_CHANGE.

Event.*_COMPLETE events contains a field event.responseCode which provides status information
and error information about a request. Response code can be one of these values:

<ul>
<li>GoogleBilling.OK: Indicates that the request was sent to the server successfully. When this code is returned</li>
</ul>
in response to a checkBillingSupported function, indicates that billing is supported.
<ul>
<li>GoogleBilling.USER_CANCELED: Indicates that the user pressed the back button on the checkout page instead of buying the item.</li>
<li>GoogleBilling.SERVICE_UNAVAILABLE: Indicates that the network connection is down.</li>
<li>GoogleBilling.BILLING_UNAVAILABLE: Indicates that in-app billing is not available because the API version that</li>
</ul>
you specified is not recognized by the Google Play application or the user is ineligible for in-app billing
(for example, the user resides in a country that prohibits in-app purchases).
<ul>
<li>GoogleBilling.ITEM_UNAVAILABLE: Indicates that Google Play cannot find the requested item in the application's product list.</li>
</ul>
This can happen if the product ID is misspelled in your requestPurchase function or if an item is unpublished in the application's product list.
<ul>
<li>GoogleBilling.DEVELOPER_ERROR: Indicates that an application is trying to make an in-app billing request but the application has not declared the</li>
</ul>
com.android.vending.BILLING permission in its manifest. Can also indicate that an application is not properly signed,
or that you sent a malformed request, such as a request with missing Bundle keys or a request that uses an unrecognized request type.
<ul>
<li>GoogleBilling.ERROR: Indicates an unexpected server error. For example, this error is triggered if you try to purchase an item from yourself, which is not allowed by Google Wallet.</li>
</ul>

<h3># Event.CHECK_BILLING_SUPPORTED_COMPLETE</h3>
Dispatched when checkBillingSuported function completes. It contains event.responseCode and event.productType fields.

<h3># Event.REQUEST_PURCHASE_COMPLETE</h3>
Dispatched when requestPurchase function completes. It contains event.responseCode, event.productId, event.productType and event.developerPayload fields.

<h3># Event.RESTORE_TRANSACTIONS_COMPLETE</h3>
Dispatched when restoreTransactions function completes. It contains event.responseCode fields.

<h3># Event.CONFIRM_NOTIFICATION_COMPLETE</h3>
Dispatched when confirmNotification function completes. It contains event.responseCode and event.notificationId fields.

<h3># Event.PURCHASE_STATE_CHANGE</h3>
Dispatched when information about a transaction is received. It contains event.purchaseState, event.productId, event.notificationId, event.purchaseTime and event.developerPayload fields.

Methods

GoogleBilling:checkBillingSupported
GoogleBilling:confirmNotification
GoogleBilling:requestPurchase
GoogleBilling:restoreTransactions
GoogleBilling:setApiVersion
GoogleBilling:setPublicKey

Events

Event.CHECK_BILLING_SUPPORTED_COMPLETE
Event.CONFIRM_NOTIFICATION_COMPLETE
Event.PURCHASE_STATE_CHANGE
Event.REQUEST_PURCHASE_COMPLETE
Event.RESTORE_TRANSACTIONS_COMPLETE

Constants

GoogleBilling.BILLING_UNAVAILABLE
GoogleBilling.CANCELED
GoogleBilling.DEVELOPER_ERROR
GoogleBilling.ERROR
GoogleBilling.EXPIRED
GoogleBilling.INAPP
GoogleBilling.ITEM_UNAVAILABLE
GoogleBilling.OK
GoogleBilling.PURCHASED
GoogleBilling.REFUNDED
GoogleBilling.SERVICE_UNAVAILABLE
GoogleBilling.SUBS
GoogleBilling.USER_CANCELED