When building a product or service that requires your users to pay for something, there are many ways that things can go wrong, such as delayed payments, fraud, or other such issues.
Thus, it is crucial to track these events in real-time and alert you and your team in the event of a problem.
Palzin Track lets you track payment events such as User Subscription, User Purchase, User Cancellation, and User Redemption directly from your Swift application.
Using Swift with URLSession
import Foundation
\#if canImport(FoundationNetworking)
import FoundationNetworking
\#endif
var semaphore = DispatchSemaphore (value: 0)
let parameters = "{\"project\":\"my-project\",\"channel\":\"payments\",\"event\":\"Successful Payment\",\"description\":\"[email protected] - ($19.99)\",\"icon\":\"💸\",\"notify\":true}"
let postData = parameters.data(using: .utf8)
var request = URLRequest(url: URL(string: "https://api.palzin.live/v1/log")!,timeoutInterval: Double.infinity)
request.addValue("application/json", forHTTPHeaderField: "Content-Type")
request.addValue("Bearer YOUR_API_TOKEN", forHTTPHeaderField: "Authorization")
request.httpMethod = "POST"
request.httpBody = postData
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
semaphore.signal()
return
}
print(String(data: data, encoding: .utf8)!)
semaphore.signal()
}
task.resume()
semaphore.wait()
Connect Palzin Track to your Swift code to easily track and keep a record of your product's payment events. With Palzin Track, you can create simple charts and journeys to help you better understand your product. Palzin Track also allows you to receive real-time push notifications on your desktop and mobile devices whenever a new payment event occurs.
Palzin Track reveals the human stories behind your data. Make user-centric decisions that drive growth.