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

My Server how to know it can delivery product to user with StoreKit2(Client)
 
 
Q