Logging Purchases for Android/FireOS
Record in-app purchases so that you can track your revenue over time and across revenue sources, as well as segment your users by their lifetime value.
Braze supports purchases in multiple currencies. Purchases that you report in a currency other than USD will be shown in the dashboard in USD based on the exchange rate at the date they were reported.
Before implementation, be sure to review examples of the segmentation options afforded by custom events vs. custom attributes vs. purchase events in our Analytics Overview.
Tracking Purchases & Revenue
To use this feature, add this method call after a successful purchase in your app:
1 2 3 4 5 6 Braze.getInstance(context).logPurchase( String productId, String currencyCode, BigDecimal price, int quantity );
1 2 3 4 5 6 Braze.getInstance(context).logPurchase( productId: String, currencyCode: String, price: BigDecimal, quantity: Int )
If the product Identifier is empty, the purchase will not be logged to Braze. See the Javadoc for more information.
If you pass in a value of
10 USD, and a quantity of
3 then that will log to the user’s profile as 3 purchases of 10 dollars for a total of 30 dollars. Quantities must be less than or equal to 100. Values of purchases can be negative.
You can add metadata about purchases by passing a Braze Properties object with your purchase information.
Properties are defined as key-value pairs. Keys are
String objects and values can be
1 2 3 BrazeProperties purchaseProperties = new BrazeProperties(); purchaseProperties.addProperty("key", "value"); Braze.getInstance(context).logPurchase(..., purchaseProperties);
1 2 3 val purchaseProperties = BrazeProperties() purchaseProperties.addProperty("key", "value") Braze.getInstance(context).logPurchase(..., purchaseProperties)
See the Javadoc for more information.
The following keys are RESERVED and CANNOT be used as Purchase Properties:
You can also use our REST API to record purchases. Refer to the User API documentation for details.