ERC-721 OpenSea integration with custom royalties

Hello,

Our minting platform will be implementing buy/sell functionality like this:

function buy(uint256 tokenId)external payable{
        require(ArtPieces[tokenId].isValue, "No token found with specified id");
        require(ArtPieces[tokenId].Listed, "NFT is not for sale");
        require(msg.value == ArtPieces[tokenId].SalePrice, "Invalid amount sent up");
        //Give royalties to original contract owner
        uint256 ownerCut = (msg.value * 2) / 100;
        payable(owner).transfer(ownerCut);

        //Give royalties to NPort (1%)
        uint256 nportCut = (msg.value * 1) / 100;
        payable(0x16c22e9A1727967553F2358aA873B4e0f8A049d0).transfer(nportCut);

        //Give current owner the rest
        payable(ArtPieces[tokenId].Owner).transfer(msg.value - ownerCut - nportCut);

        //transfer the token
        IERC721Upgradeable tokenContract = IERC721Upgradeable(address(this));
        tokenContract.safeTransferFrom(ArtPieces[tokenId].Owner, msg.sender, tokenId);

        //transfer ownership
        ArtPieces[tokenId].Owner = msg.sender;
        ArtPieces[tokenId].Listed = false;

    }

Our contract currently interfaces with OpenSea, although they probably have their own buy function, so no cuts are handed out. Does anyone know of a way we could retain our royalties while allowing users to still use our contract on third party websites like OpenSea or Rarible?

Thanks!

I would probably say you need to have both set, but it is not bulletproof. You have this BUY on your site and you set royalties on Open Sea so it is using what you set there, probably using atomicMatch_ function of that Project Wyvern (was checking on rinkeby) and what happens on selling. So both of those are covered but as people could still transfer token with safeTransferFrom and ignore both you are not fully covered until you have royalties set in core of method for transfering tokens.