Trigger user sync with function

I am adding a role to the user on product purchase, and I want that role to sync immediately. Is there a trigger I can use to sync a user on custom function?