Skip to content
This repository was archived by the owner on Mar 7, 2024. It is now read-only.

Commit cfcc6ff

Browse files
committed
Add server tokens and shift enq to reg
1 parent 31ea1b1 commit cfcc6ff

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/views/pages/Course/ApplyModal.js

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ export default function ApplyModal({ batch, fullWidth = false, ...rest }) {
5555
setOpen(true);
5656
formData.countryCode = '+91';
5757
formData.phone = '';
58+
formData.priceId = batch.priceId;
5859
};
5960

6061
const handleClose = () => {
@@ -76,30 +77,24 @@ export default function ApplyModal({ batch, fullWidth = false, ...rest }) {
7677
axios({
7778
method: 'post',
7879
url:
79-
'https://us-central1-codeforcauseorg.cloudfunctions.net/widgets/courseenquiries',
80+
'https://us-central1-codeforcauseorg.cloudfunctions.net/widgets/courseregs',
8081
data: formData
8182
})
8283
.then(response => {
8384
setSubmitting(0);
8485
handleClose();
8586
enqueueSnackbar('Application Submitted Successfully');
8687
stripePromise.then(stripe => {
87-
stripe.redirectToCheckout({
88-
lineItems: [
89-
// Replace with the ID of your price
90-
{ price: batch.priceId, quantity: 1 }
91-
],
92-
mode: 'payment',
93-
successUrl: `https://${window.location.hostname}/success`,
94-
cancelUrl: `https://${window.location.hostname}/canceled`
95-
})
96-
.then(function(result) {
97-
// If `redirectToCheckout` fails due to a browser or network
98-
// error, display the localized error message to your customer
99-
// using `result.error.message`.
100-
});
88+
stripe
89+
.redirectToCheckout({
90+
sessionId: response.data.id
91+
})
92+
.then(function(result) {
93+
// If `redirectToCheckout` fails due to a browser or network
94+
// error, display the localized error message to your customer
95+
// using `result.error.message`.
96+
});
10197
});
102-
10398
})
10499
.catch(error => {
105100
enqueueSnackbar('Application Failed. Try again later');

0 commit comments

Comments
 (0)