Skip to content

Commit

Permalink
fix transaction metadata in purchase tester app
Browse files Browse the repository at this point in the history
  • Loading branch information
fire-at-will authored Nov 20, 2024
1 parent 6d297aa commit f46bea2
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,13 @@ struct OfferingDetailView: View {

let result: PurchaseResultData
if let metadata = customerData.metadata {
#if ENABLE_TRANSACTION_METADATA
let params = PurchaseParams.Builder(package: package).with(metadata: metadata).build()
#else
let params = PurchaseParams.Builder(package: package).build()
print("⚠️ Warning - ENABLE_TRANSACTION_METADATA feature flag is not enabled")
print("⚠️ Warning - Metadata will not be sent with the purchase")
#endif
result = try await Purchases.shared.purchase(params)
} else {
result = try await Purchases.shared.purchase(package: self.package)
Expand All @@ -151,7 +157,13 @@ struct OfferingDetailView: View {

let result: PurchaseResultData
if let metadata = customerData.metadata {
let params = PurchaseParams.Builder(product: self.package.storeProduct).with(metadata: metadata).build()
#if ENABLE_TRANSACTION_METADATA
let params = PurchaseParams.Builder(package: package).with(metadata: metadata).build()
#else
let params = PurchaseParams.Builder(package: package).build()
print("⚠️ Warning - ENABLE_TRANSACTION_METADATA feature flag is not enabled")
print("⚠️ Warning - Metadata will not be sent with the purchase")
#endif
result = try await Purchases.shared.purchase(params)
} else {
result = try await Purchases.shared.purchase(product: self.package.storeProduct)
Expand Down

0 comments on commit f46bea2

Please sign in to comment.