Post

Replies

Boosts

Views

Activity

SubscriptionStoreView how to handle the Cancellation Button
Hi All, I use the SubscriptionStoreView and it displays a cancellation button in the upper right corner. How do I set a value of a local variable and dismiss the SubscriptionStoreView when the user clicks the cancellation button? Right now it seems as if the cancellation button is disabled and nothing happens when I press the cancellation button. Any help is appreciated. Regards Thomas S
1
0
434
Mar ’24
Encode purchase payload as JSON and pass to request.httpBody
Hi All, I have this code and I would like to send the payload of the completed purchase to my server. How to do that? Regards Thomas S ` SubscriptionStoreView(...) .onInAppPurchaseCompletion { product, result in if case .success(.success(let transaction)) = result { print("Purchased successfully: \(transaction.signedDate)") // this looks good in Xcode // Pass payload of transaction to my server let url = URL(string: "... my server ...")! var request = URLRequest(url: url) request.httpMethod = "POST" request.httpBody = ???? // how do I pass the payload of the transaction to the httpBody request.setValue("application/json", forHTTPHeaderField: "Content-Type") let task = URLSession.shared.dataTask(with: request) { data, response, error in let statusCode = (response as! HTTPURLResponse).statusCode if statusCode == 200 { print("SUCCESS") } else { print("FAILURE") } } task.resume() } else { print("Something else happened") } } `
2
0
444
Mar ’24
Get originalTransactionId in app after completed purchase
Hi all, how do I get the originalTransactionId in an app after completed purchase. I use SubscriptionStoreView and onInAppPurchaseCompletion but I don't know how to extract the originalTransactionId. Any help would be appreciated. From https://developer.apple.com/documentation/appstoreserverapi/originaltransactionid I read "To get the original transaction identifier from your app, use the originalID property of the Transaction object that represents the in-app purchase. " So I assume I can extract the originalTransactionId in the code following onInAppPurchaseCompletion Regards Thomas S
0
0
331
Mar ’24