@@ -55,6 +55,7 @@ export default function ApplyModal({ batch, fullWidth = false, ...rest }) {
55
55
setOpen ( true ) ;
56
56
formData . countryCode = '+91' ;
57
57
formData . phone = '' ;
58
+ formData . priceId = batch . priceId ;
58
59
} ;
59
60
60
61
const handleClose = ( ) => {
@@ -76,30 +77,24 @@ export default function ApplyModal({ batch, fullWidth = false, ...rest }) {
76
77
axios ( {
77
78
method : 'post' ,
78
79
url :
79
- 'https://us-central1-codeforcauseorg.cloudfunctions.net/widgets/courseenquiries ' ,
80
+ 'https://us-central1-codeforcauseorg.cloudfunctions.net/widgets/courseregs ' ,
80
81
data : formData
81
82
} )
82
83
. then ( response => {
83
84
setSubmitting ( 0 ) ;
84
85
handleClose ( ) ;
85
86
enqueueSnackbar ( 'Application Submitted Successfully' ) ;
86
87
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
+ } ) ;
101
97
} ) ;
102
-
103
98
} )
104
99
. catch ( error => {
105
100
enqueueSnackbar ( 'Application Failed. Try again later' ) ;
0 commit comments