Skip to content

Signals🔗

This page documents all signals emitted by the BillingClient.

Signals are used to receive asynchronous results from the Google Play Billing system.

Most billing operations (queries, purchases, acknowledgements) return their final results through signals.


acknowledge_purchase_response🔗

signal acknowledge_purchase_response(response: Dictionary)

Emitted when an acknowledge purchase request finishes.

response: Dictionary contains the result of this request:

  • response_code: int - A value from BillingResponseCode.
  • debug_message: String - Debug message returned by Google Play billing library.
  • token: String - The purchase token associated with the request.

connect_error🔗

signal connect_error(response_code: int, debug_message: String)

Emitted when the billing client fails to connect to the Google Play Billing service.

  • response_code: int - Error code from BillingResponseCode.
  • debug_message: String - Debug message returned by Google Play billing library.

connected🔗

signal connected

Emitted when the billing client successfully connects to the Google Play Billing service.

Once this signal is received, billing operations such as product queries and purchases can be performed.


consume_purchase_response🔗

signal consume_purchase_response(response: Dictionary)

Emitted when a consumable purchase has been successfully consumed or if the request failed.

response: Dictionary contains the result of the consume request:

  • response_code: int - A value from BillingResponseCode.
  • debug_message: String - Debug message returned by Google Play billing library.
  • token: String - The purchase token that was consumed.

disconnected🔗

signal disconnected

Emitted when the billing client disconnects from the Google Play Billing service.

This can happen due to network interruptions or if the service connection is lost.


on_purchase_updated🔗

signal on_purchase_updated(response: Dictionary)

Emitted when the purchase state changes.

This signal is triggered after a purchase flow completes or when a pending purchase updates.

response: Dictionary contains purchase update information:

  • response_code: int - A value from BillingResponseCode.
  • debug_message: String - Debug message returned by Google Play billing library.
  • purchases: Array - Array of purchase dictionaries owned by the user.

Each purchase dictionary contains:

  • order_id: String
  • purchase_token: String
  • package_name: String
  • purchase_state: int (see PurchaseState)
  • purchase_time: int (milliseconds since the epoch (Jan 1, 1970))
  • original_json: String
  • is_acknowledged: bool
  • is_auto_renewing: bool
  • quantity: int
  • signature: String
  • product_ids: PackedStringArray

Example

func _on_purchase_updated(result):
    if result.response_code == BillingClient.BillingResponseCode.OK:
        for purchase in result.purchases:
            print("Purchased:", purchase.product_ids)

query_product_details_response🔗

signal query_product_details_response(response: Dictionary)

Emitted after query_product_details(...) finishes.

response: Dictionary contains product information or an error.

  • response_code: int - A value from BillingResponseCode.
  • debug_message: String - Debug message returned by Google Play.
  • product_details: Array - Array of product details dictionaries.

Example

func _on_query_product_details_response(result):
    if result.response_code == BillingClient.BillingResponseCode.OK:
        for product in result.product_details:
            print(product)

query_purchases_response🔗

signal query_purchases_response(response: Dictionary)

Emitted when query_purchases(...) completes.

response: Dictionary contains the result of the purchase query.

  • response_code: int - A value from BillingResponseCode.
  • debug_message: String - Debug message returned by Google Play.
  • purchases: Array - Array of purchase dictionaries owned by the user.

Example

func _on_query_purchases_response(result):
    if result.response_code == BillingClient.BillingResponseCode.OK:
        for purchase in result.purchases:
            print("Owned:", purchase.product_ids)