Wednesday, June 10, 2026
HomeiOS Developmentios - Swift: Consumable in-app buy rewarded with out transaction

ios – Swift: Consumable in-app buy rewarded with out transaction

[ad_1]

I’m unfamiliar with how IAPs repeatedly run, however my code in paymentQueue seems to reward the person the acquisition with none fee immediate. My code is as follows:

func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions [SKPaymentTransaction]) {
  for transaction in transactions {
    change transaction.transactionState {
    case .buying:
      break
    case .bought, .restored:
      if transaction.fee.productIdentifier == "sn_0199_ra" {
        //Take away advertisements (not consumable)
      }
      else if transaction.fee.productIdentifier == "sn_0199_1000c" {
        //Give person 1000 cash (consumable)
      }
      else if transaction.fee.productIdentifier == "sn_0999_10000c" {
        //Give person 10000 cash (consumable)
      }
      break

    case .failed, .deferred:
      SKPaymentQueue.default().finishTransaction(transaction)
      SKPaymentQueue.default().take away(self)
      break

    default:
      break
    }
  }
}

Primarily, once I make a purchase order usually as soon as, every little thing is profitable with a message confirming the acquisition. Subsequently, that IAP is accomplished with none new fee prompts.

The output I obtain when this occurs is:

[<SKPaymentTransaction: 0x281278b60>]
2022-04-18 00:10:50.117021+0200 XXX[826:69224]  - <Google>[I-ACS023141] Buy is a replica and won't be reported. Product ID: sn_0999_10000c

Did I make a mistake or is that this only a common course of and transactions are nonetheless coming by?

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments