Post

Replies

Boosts

Views

Activity

My Server how to know it can delivery product to user with StoreKit2(Client)
Hi My App has realize IAP function by StoreKit1, the flow just like this: 1.My app purchase one product by storekit1 2.When user has purchased, my app receive purchased transaction object 3.App send local device receipt to my server 4.My server use verifyReceipt Api to get transaction info, So my server can delivery product to current user But With StoreKit2 how my server valid purchase? 1.Plan A func checkVerified<T>(_ result: VerificationResult<T>) throws -> T {     //Check if the transaction passes StoreKit verification.     switch result {     case .unverified:       //StoreKit has parsed the JWS but failed verification. Don't deliver content to the user.       throw NTESiTAStoreError.failedVerification     case .verified(let safe):       //If the transaction is verified, unwrap and return it.       return safe     }   } then i can get the transacation: let transaction = try checkVerified(result) let jwsString = result.jwsRepresentation; what can i do next? Send the original_id to my server, then my server request get purchase history Api to get transaction JWS to decode to delivery product? or my client can send some information about result or transaction from checkVerified func to my server, then my server do not need to fetch transaction info from apple server , it can delivery product directly? Plan B Can i get JWS String from result or transaction from checkVerified func like eyJhbGciOiJIUzI1NiJ9.eyJkYXRhIjoidGVzdCJ9.pNIWIL34Jo13LViZAJACzK6Yf0qnvT_BuwOxiMCPE-Y where can i receive this? when i receive it I will send it to my server , my server decode it delivery product directly without request get history API? I'm confused, because i am first time to change IAP SDK in my app, I need some suggest and guide. Thank you very much
0
1
702
Apr ’22
VerificationResult return .verified then My server can deliver content to the user directly?
Use StoreKit 2 my client IAP code like this: func purchase(_ product: Product) async throws -> Transaction? {         let orderId = UUID.init()         let result = try await product.purchase(options: [.appAccountToken(orderId)])         switch result {         case .success(let verification) :             let transaction = try checkVerified(verification) //Here can I tell my server deliver content to user? //I do not want valid transaction on device(just like valid receipt via S2S use Storekit1)             return transaction         case .userCancelled, .pending:             return nil         default:             return nil         }     } If verificationResult return ..verified() case , can I tell my server deliver content to my customer ? Or should I send originalID for this transaction to my server, my server has to fetch transaction info by history Api(decode JWS info) to decide whether to deliver content to my custom? Thank you very much
0
0
815
May ’22