From 1417aa9a1c6e835584d7f041c77590b35a3633a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Sat, 18 May 2024 14:43:57 +0200 Subject: [PATCH] Document purchaseCompleted function --- .../Presets/TelemetryDeck+Purchases.swift | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift b/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift index 2e809f7..2b5cd87 100644 --- a/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift +++ b/Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift @@ -4,6 +4,16 @@ import Foundation @available(iOS 15, macOS 12, tvOS 15, visionOS 1, watchOS 8, *) extension TelemetryDeck { + /// Sends a telemetry signal indicating that a purchase has been completed. + /// + /// - Parameters: + /// - transaction: The completed `StoreKit.Transaction` containing details about the purchase. + /// - parameters: Additional parameters to include with the signal. Default is an empty dictionary. + /// - customUserID: An optional custom user identifier. If provided, it overrides the default user identifier from the configuration. Default is `nil`. + /// + /// This function captures details about the completed purchase, including the type of purchase (subscription or one-time), + /// the country code of the storefront, and the currency code. It also converts the price to USD if necessary and sends + /// this information as a telemetry signal. The conversion happens with hard-coded values that might be out of date. public static func purchaseCompleted( transaction: StoreKit.Transaction, parameters: [String: String] = [:], @@ -203,6 +213,5 @@ extension TelemetryDeck { "ZMW": 25.4938, "ZWL": 13.3976, ] - } #endif