Apple store connect sandbox error.

Sandbox IAP test:
1. Create a Sandbox Tester Account
2. Configure IAP Products in App Store Connect
3. Add IAP Plugin in your App

local store = require("store")

local function transactionCallback(event)
    local transaction = event.transaction
    if transaction.state == "purchased" then
        print("✅ Purchase successful:", transaction.productIdentifier)
        store.finishTransaction(transaction)
    elseif transaction.state == "failed" then
        print("❌ Purchase failed:", transaction.errorString)
        store.finishTransaction(transaction)
    end
end

store.init("apple", transactionCallback)

local function buy(productID)
    store.purchase({productID})
end

4. Build and Upload the App for TestFlight
5. Prepare the Device and Log In with Sandbox Account
6. Install the Test App via TestFlight
7. Perform the In-App Purchase Test

When I follow the following process to log in to the test account and install testflight, the following error occurs:
Creation of an iTunes account is not allowed. This Apple account cannot be used in the iTunes Store at this time. Please try again later.

Please help with this issue.
Thanks

@Scott_Harrison

I don’t use iap purchase a lot but I believe you are suppose to load your products. Also you are not using the plugin at all for Apple which I think is fine but you can find more info about the plugin for apple here

I did use Apple plugins and refer to this sample:

, but strangely event.transaction is not activated after click the purchase button( showMessage(productID…“buying…please wait”)).
here is the code:

store = require "plugin.apple.iap"
popMessage=function(itemNo)
  local dialogText
  if(itemNo==1) then 
      
      dialogText="Spend NT$30,buy 300 golds?"
  elseif(itemNo==2) then 
      
      dialogText="Spend NT$150,buy 1725golds?"
  elseif(itemNo==3) then 
      
      dialogText="Spend NT$990,buy 12150golds?"
  end

local productIDs = {
    "com.long88long.30golds",
    "com.long88long.150golds",
    "com.long88long.990golds",
}
local prodList = {
    "com.long88long.30golds",
    "com.long88long.150golds",
    "com.long88long.990golds",
}


  native.showAlert(
    "buy golds ",
    dialogText,
    { "OK", "Cancel" },
    function(event)
        -- listener callback 
        if event.action == "clicked" then
            local index = event.index
            if index == 1 then
              if soundOn then
                local buttonSound=audio.play(soundTable["buttonSound"])
              end
                print("buy")
                if itemNo == 1 then
                  --store.purchase( "com.long88long.30golds" )
                  --buyItem()
                  purchaseProduct(productIDs[1])
                elseif itemNo == 2 then
                  --store.purchase( "com.long88long.150golds" )
                  purchaseProduct(productIDs[2])  
                elseif itemNo == 3 then
                  --store.purchase( "com.long88long.990golds" ) 
                  purchaseProduct(productIDs[3]) 
                end  
            elseif index == 2 then
              if soundOn then
                local cancelSound=audio.play(soundTable["cancelSound"])
              end
                print("cancel")
            end
        end
    end
  )  
end  

    purchaseProduct = function(productID)
    --local function purchaseProduct(productID)
        if store.isActive then
            showMessage(productID.."buying..please wait")
            store.purchase({ productID })
        else
            showMessage("❌ store not activated")
        
        end
    end
    store.init( "apple", function(event) 
        local t = event.transaction
        showMessage("store.init")
        if t then
            showMessage("t.state")
            if t.state == "restored" or t.state == "purchased" then
                local verified = verifyPurchase(t.originalIdentifier or t.identifier)
                print("Verified purchase", verified)
                native.showAlert("Purchase Verified", tostring(verified), {"OK"})
                -- purchase sucessfully
                local productID = transaction.productIdentifier
                local diamonds = productDiamonds[productID]
                --currentGold = currentGold + diamonds
                giveGameDiamond(diamonds)
                --playerDiamonds = playerDiamonds + diamonds

                showMessage("✅ Purchase Verified!get " .. diamonds .. " golds!")
            end
        end
        store.finishTransaction( t )
        --native.setActivityIndicator( false )
    end)
    verifyPurchase = function(originalIdentifier)
        print("Verifying", originalIdentifier)
        showMessage("verifyPurchase")
        local iaps = store.receiptDecrypted().in_app
        for i=1,#iaps do
            local iap = iaps[i]
            if iap.original_transaction_id == originalIdentifier then
                return true
            end
        end
        return false
    end 


I don’t know what went wrong.
Is there any sample code and guide to setup the apple store connect sandbox?

Thanks!