Skip to content

Instantly share code, notes, and snippets.

@SimonHoiberg
Created June 19, 2020 14:53
Show Gist options
  • Save SimonHoiberg/1da7cc5f308eeb0e59f32aead5c68815 to your computer and use it in GitHub Desktop.
Save SimonHoiberg/1da7cc5f308eeb0e59f32aead5c68815 to your computer and use it in GitHub Desktop.
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