@@ -161,18 +161,18 @@ const useCheckoutMutations = () => {
161161 card . setIdle ( ) ;
162162 } ;
163163
164- const payWithExistingPaymentSource = ( e : React . FormEvent < HTMLFormElement > ) => {
164+ const payWithExistingPaymentMethod = ( e : React . FormEvent < HTMLFormElement > ) => {
165165 e . preventDefault ( ) ;
166166
167167 const data = new FormData ( e . currentTarget ) ;
168- const paymentMethodId = data . get ( HIDDEN_INPUT_NAME ) as string ;
168+ const paymentSourceId = data . get ( HIDDEN_INPUT_NAME ) as string ;
169169
170170 return confirmCheckout ( {
171- paymentMethodId ,
171+ paymentSourceId ,
172172 } ) ;
173173 } ;
174174
175- const addPaymentSourceAndPay = ( ctx : { gateway : 'stripe' ; paymentToken : string } ) => confirmCheckout ( ctx ) ;
175+ const addPaymentMethodAndPay = ( ctx : { gateway : 'stripe' ; paymentToken : string } ) => confirmCheckout ( ctx ) ;
176176
177177 const payWithTestCard = ( ) =>
178178 confirmCheckout ( {
@@ -181,8 +181,8 @@ const useCheckoutMutations = () => {
181181 } ) ;
182182
183183 return {
184- payWithExistingPaymentSource ,
185- addPaymentSourceAndPay ,
184+ payWithExistingPaymentMethod ,
185+ addPaymentMethodAndPay ,
186186 payWithTestCard,
187187 } ;
188188} ;
@@ -345,13 +345,13 @@ const useSubmitLabel = () => {
345345} ;
346346
347347const AddPaymentSourceForCheckout = withCardStateProvider ( ( ) => {
348- const { addPaymentSourceAndPay } = useCheckoutMutations ( ) ;
348+ const { addPaymentMethodAndPay } = useCheckoutMutations ( ) ;
349349 const submitLabel = useSubmitLabel ( ) ;
350350 const { checkout } = useCheckout ( ) ;
351351
352352 return (
353353 < AddPaymentSource . Root
354- onSuccess = { addPaymentSourceAndPay }
354+ onSuccess = { addPaymentMethodAndPay }
355355 checkout = { checkout }
356356 >
357357 < DevOnly >
@@ -375,9 +375,9 @@ const ExistingPaymentSourceForm = withCardStateProvider(
375375 const { checkout } = useCheckout ( ) ;
376376 const { paymentMethod, isImmediatePlanChange, freeTrialEndsAt } = checkout ;
377377
378- const { payWithExistingPaymentSource } = useCheckoutMutations ( ) ;
378+ const { payWithExistingPaymentMethod } = useCheckoutMutations ( ) ;
379379 const card = useCardState ( ) ;
380- const [ selectedPaymentSource , setSelectedPaymentSource ] = useState < BillingPaymentMethodResource | undefined > (
380+ const [ selectedPaymentMethod , setSelectedPaymentMethod ] = useState < BillingPaymentMethodResource | undefined > (
381381 paymentMethod || paymentSources . find ( p => p . isDefault ) ,
382382 ) ;
383383
@@ -399,7 +399,7 @@ const ExistingPaymentSourceForm = withCardStateProvider(
399399
400400 return (
401401 < Form
402- onSubmit = { payWithExistingPaymentSource }
402+ onSubmit = { payWithExistingPaymentMethod }
403403 sx = { t => ( {
404404 display : 'flex' ,
405405 flexDirection : 'column' ,
@@ -408,20 +408,20 @@ const ExistingPaymentSourceForm = withCardStateProvider(
408408 >
409409 { showPaymentMethods ? (
410410 < Select
411- elementId = 'paymentSource '
411+ elementId = 'paymentMethod '
412412 options = { options }
413- value = { selectedPaymentSource ?. id || null }
413+ value = { selectedPaymentMethod ?. id || null }
414414 onChange = { option => {
415415 const paymentSource = paymentSources . find ( source => source . id === option . value ) ;
416- setSelectedPaymentSource ( paymentSource ) ;
416+ setSelectedPaymentMethod ( paymentSource ) ;
417417 } }
418418 portal
419419 >
420420 { /*Store value inside an input in order to be accessible as form data*/ }
421421 < input
422422 name = { HIDDEN_INPUT_NAME }
423423 type = 'hidden'
424- value = { selectedPaymentSource ?. id }
424+ value = { selectedPaymentMethod ?. id }
425425 />
426426 < SelectButton
427427 icon = { ChevronUpDown }
@@ -430,7 +430,7 @@ const ExistingPaymentSourceForm = withCardStateProvider(
430430 backgroundColor : t . colors . $colorBackground ,
431431 } ) }
432432 >
433- { selectedPaymentSource && < PaymentSourceRow paymentSource = { selectedPaymentSource } /> }
433+ { selectedPaymentMethod && < PaymentSourceRow paymentSource = { selectedPaymentMethod } /> }
434434 </ SelectButton >
435435 < SelectOptionList
436436 sx = { t => ( {
@@ -443,7 +443,7 @@ const ExistingPaymentSourceForm = withCardStateProvider(
443443 < input
444444 name = { HIDDEN_INPUT_NAME }
445445 type = 'hidden'
446- value = { selectedPaymentSource ?. id }
446+ value = { selectedPaymentMethod ?. id }
447447 />
448448 ) }
449449 < Card . Alert > { card . error } </ Card . Alert >
0 commit comments