backend-manager 5.0.85 → 5.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -38,6 +38,26 @@ module.exports = {
|
|
|
38
38
|
|
|
39
39
|
assistant?.log(`Stripe checkout: priceId=${priceId}, uid=${uid}, customerId=${customer.id}, trial=${trial}, trialDays=${product.trial?.days || 'none'}`);
|
|
40
40
|
|
|
41
|
+
// Build confirmation redirect URL with order details
|
|
42
|
+
const baseUrl = config.brand?.url;
|
|
43
|
+
const amount = product.prices?.[frequency]?.amount || 0;
|
|
44
|
+
|
|
45
|
+
const confirmationUrl = new URL('/payment/confirmation', baseUrl);
|
|
46
|
+
confirmationUrl.searchParams.set('orderId', '{CHECKOUT_SESSION_ID}');
|
|
47
|
+
confirmationUrl.searchParams.set('productId', productId);
|
|
48
|
+
confirmationUrl.searchParams.set('productName', product.name || productId);
|
|
49
|
+
confirmationUrl.searchParams.set('amount', trial && product.trial?.days ? '0' : String(amount));
|
|
50
|
+
confirmationUrl.searchParams.set('currency', 'USD');
|
|
51
|
+
confirmationUrl.searchParams.set('frequency', frequency);
|
|
52
|
+
confirmationUrl.searchParams.set('paymentMethod', 'stripe');
|
|
53
|
+
confirmationUrl.searchParams.set('trial', String(!!trial && !!product.trial?.days));
|
|
54
|
+
confirmationUrl.searchParams.set('track', 'true');
|
|
55
|
+
|
|
56
|
+
const cancelUrl = new URL('/payment/checkout', baseUrl);
|
|
57
|
+
cancelUrl.searchParams.set('product', productId);
|
|
58
|
+
cancelUrl.searchParams.set('frequency', frequency);
|
|
59
|
+
cancelUrl.searchParams.set('payment', 'cancelled');
|
|
60
|
+
|
|
41
61
|
// Build session params
|
|
42
62
|
const sessionParams = {
|
|
43
63
|
mode: 'subscription',
|
|
@@ -51,8 +71,8 @@ module.exports = {
|
|
|
51
71
|
uid: uid,
|
|
52
72
|
},
|
|
53
73
|
},
|
|
54
|
-
success_url:
|
|
55
|
-
cancel_url:
|
|
74
|
+
success_url: confirmationUrl.toString(),
|
|
75
|
+
cancel_url: cancelUrl.toString(),
|
|
56
76
|
metadata: {
|
|
57
77
|
uid: uid,
|
|
58
78
|
productId: productId,
|