Query Single Product Details
This function behaves similarly to QueryProductDetails, but is designed to retrieve details for a single product ID instead of a list.
It is an asynchronous call that returns a single Product Details object from the Google Play Console, including price, currency, title, description, and subscription offers if applicable.
You can use the returned data to display an individual shop item, show product information, or prepare an in-app purchase flow. The function also provides the Offer Token, which can later be used when launching a Billing Flow.
Parameters include a single Product ID and a Product Type, which defines whether the query targets an in-app product or a subscription. When the operation completes, one of two delegates will trigger — success or failure — depending on the result of the query.
Parameters
1. Product ID
A single product ID to request from the Google Play Console. This ID should match a product you’ve configured in your Play Store listing.
2. Product Type
Specifies the type of products to query — either In-App or Subscription. See EProductType for available values.
3. On Success
Triggered when product details have been successfully retrieved. Returns a single FProductDetails object that includes all pricing and metadata information. You can drag this pin to create a custom event and use the data in your shop or UI.
4. On Failure
Triggered when the request fails. Returns:
- Response Code —
EBillingResponseCode - Error Message —
FStringwith additional debug information.
Use this delegate to handle issues.
Example
In this example, the Query Single Product Details node requests detailed information for a specific in-app product from the Google Play Console. When the query succeeds, the returned Product Details struct is passed to a Custom Event, where its fields are accessed using the Break Product Details node.
The setup shown below extracts the Formatted Price from the One Time Purchase Offer Details and displays it in a UI text widget using Set Text. This allows you to dynamically show the product’s localized price and other details such as title and description directly in your in-game shop.
C++ Usage
You can fetch product details directly from C++ by providing a product ID and handling success or failure through delegates.
#include "BillingCPPLibrary.h"
void UMyGameInstance::FetchSingleProductDetails()
{
FString ProductID = TEXT("coins_pack_1");
FOnSingleProductDetailsQuerySuccessfulNative OnSuccess;
OnSuccess.BindLambda([](const FProductDetails& ProductDetails)
{
UE_LOG(LogTemp, Log, TEXT("Successfully retrieved product price: %s"), *ProductDetails.OneTimePurchaseOfferDetails.FormattedPrice);
});
FOnSingleProductDetailsQueryFailedNative OnFailure;
OnFailure.BindLambda([](EBillingResponseCode Code, const FString& Message)
{
UE_LOG(LogTemp, Error, TEXT("Failed to query product details: %s (Code: %d)"), *Message, static_cast<int32>(Code));
});
UBillingCPPLibrary::QuerySingleProductDetails(ProductID, EProductType::INAPP, OnSuccess, OnFailure);
}