Created
June 19, 2020 14:53
-
-
Save SimonHoiberg/1da7cc5f308eeb0e59f32aead5c68815 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StripeManager { | |
... | |
public static async getStripeCustomerID() { | |
// Retrieve the current customerID from the currently logged in user | |
// getUserFromDB() is *your* implemention of getting user info from the DB | |
const { customerID } = getUserFromDB(); | |
if (!customerID) { | |
const customer = await this.createCustomer(); | |
return customer?.id; | |
} | |
return customerID; | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment