refactored stripe code