Ok... so I have between now and when the next block reward reduction occurs to make sure I get the proper Pay Per Share. So everyone here can help me out as you are the ones that will be paid.
The target of a share is 0x03ffffffffffffff.....
The target of a block is 0000fff000000000000000000000000000000000000000000000000000000000
PPS is calculated as BLOCK_REWARD * SHARE_TARGET / BLOCK_TARGET which according to my calculations is: 0.0397708 PER SHARE.
Invalid Shares occur anytime the provided data is stale... and there is a known bug that you get one 'invalid' count on startup.
Now ON AVERAGE the pool should be able to pay out .0397708 per share so the way I have tentatively designed the system is to automatically payout when it can and hold a balance anytime the lottery is working against the pool.
The only remaining variable is how to account for orphaned blocks which effectively increase the difficulty and thus should decrease the average block reward. I will probably have to allow a couple percent margin for stale blocks in order to honor the PPS system.