refactored code to use generic StripeObject