Skip to content

Commit

Permalink
Addressed a couple of issues with the subscriber portal - warning it …
Browse files Browse the repository at this point in the history
…takes a few seconds and checking that firebase is initialized
  • Loading branch information
tconfrey committed Oct 10, 2024
1 parent 28960cd commit b26b31f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/subscriptionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ async function openStripePortal() {
alert('BrainTool Id not set!');
return;
}
alert("Opening Stripe portal to manage your subscription. This may take a few seconds.");
const url = await getStripePortalURL();
window.open(url, '_blank');
}
Expand Down Expand Up @@ -316,6 +317,7 @@ async function subscribe(productPrice) {
line_items: [selectedPrice],
success_url: baseURL + '?purchase=' + encodeURIComponent('subscription'),
cancel_url: baseURL + '?purchase=' + encodeURIComponent('cancelled'),
// description: "BrainTool Supporter Subscription ID: " + BTId,
};
try {
const docRef = await FBDB
Expand Down Expand Up @@ -355,6 +357,7 @@ async function purchase(productPrice) {
allow_promotion_codes: true,
success_url: baseURL+ '?purchase=' + encodeURIComponent('product'),
cancel_url: baseURL + '?purchase=' + encodeURIComponent('cancelled'),
// description: "BrainTool Supporter License ID: " + BTId,
};
try {
const docRef = await FBDB.collection("customers").doc(BTId).collection("checkout_sessions").add(checkoutSession);
Expand Down Expand Up @@ -411,6 +414,7 @@ async function RCPurchase(sessionId) {
async function getStripePortalURL() {
// Billing portal handler
let rsp;
FBDB || await initializeFirebase();
try {
const functionRef = firebase
.app()
Expand Down
4 changes: 4 additions & 0 deletions versions/1.0.3/app/subscriptionManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ async function openStripePortal() {
alert('BrainTool Id not set!');
return;
}
alert("Opening Stripe portal to manage your subscription. This may take a few seconds.");
const url = await getStripePortalURL();
window.open(url, '_blank');
}
Expand Down Expand Up @@ -316,6 +317,7 @@ async function subscribe(productPrice) {
line_items: [selectedPrice],
success_url: baseURL + '?purchase=' + encodeURIComponent('subscription'),
cancel_url: baseURL + '?purchase=' + encodeURIComponent('cancelled'),
// description: "BrainTool Supporter Subscription ID: " + BTId,
};
try {
const docRef = await FBDB
Expand Down Expand Up @@ -355,6 +357,7 @@ async function purchase(productPrice) {
allow_promotion_codes: true,
success_url: baseURL+ '?purchase=' + encodeURIComponent('product'),
cancel_url: baseURL + '?purchase=' + encodeURIComponent('cancelled'),
// description: "BrainTool Supporter License ID: " + BTId,
};
try {
const docRef = await FBDB.collection("customers").doc(BTId).collection("checkout_sessions").add(checkoutSession);
Expand Down Expand Up @@ -411,6 +414,7 @@ async function RCPurchase(sessionId) {
async function getStripePortalURL() {
// Billing portal handler
let rsp;
FBDB || await initializeFirebase();
try {
const functionRef = firebase
.app()
Expand Down

0 comments on commit b26b31f

Please sign in to comment.