Purchase Event
How to send purchase events
Use PurchaseData
and AppEvent
to send a purchase event when the user completes an in-app purchase.
Send this event every time a user completes a transaction.
purchase_data = PurchaseData() \
.set_item_id("item_123") \
.set_item_name("No Ads") \
.set_value(3.99) \
.set_currency("usd") \
.set_status("completed")
purchase_event = AppEvent(client, purchase_data, user_data)
try:
response = purchase_event.send()
print("Purchase event sent.")
except Exception as e:
print("Error sending purchase event:", e)
Prop | Type | Default |
---|---|---|
status | string | - |
currency | string | - |
value | double | - |
item_name | string | - |
item_id | string | - |
Status Field Values
Use "Completed"
for successful purchases and "Failed"
for failed transactions. While the SDK doesn't enforce these values, using different status names may impact attribution accuracy.
For questions about status values, you can reach out to our support team.
Item ID
The item_id parameter should represent the unique identifier for the product or item being purchased, not the transaction ID. Using the correct product identifier ensures proper tracking and attribution of purchases in your analytics.
Purchase events help attribute revenue to campaigns and creatives, enabling optimization of your monetization funnel.