Skip to content

Commit

Permalink
Document purchaseCompleted function
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed May 18, 2024
1 parent b9e8c4d commit 1417aa9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Sources/TelemetryClient/Presets/TelemetryDeck+Purchases.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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] = [:],
Expand Down Expand Up @@ -203,6 +213,5 @@ extension TelemetryDeck {
"ZMW": 25.4938,
"ZWL": 13.3976,
]

}
#endif

0 comments on commit 1417aa9

Please sign in to comment.