mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Use custom save card payment checkbox and show/hide it based on vaulting setting
This commit is contained in:
parent
13b5338627
commit
880bd48271
6 changed files with 45 additions and 13 deletions
|
@ -1,12 +1,21 @@
|
|||
import {useEffect} from '@wordpress/element';
|
||||
import {usePayPalCardFields} from "@paypal/react-paypal-js";
|
||||
|
||||
export const CheckoutHandler = ({getCardFieldsForm}) => {
|
||||
export const CheckoutHandler = ({getCardFieldsForm, getSavePayment, saveCardText, is_vaulting_enabled}) => {
|
||||
const {cardFieldsForm} = usePayPalCardFields();
|
||||
|
||||
useEffect(() => {
|
||||
getCardFieldsForm(cardFieldsForm)
|
||||
}, []);
|
||||
|
||||
return null
|
||||
if (!is_vaulting_enabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<input type="checkbox" id="save" name="save" onChange={(e) => getSavePayment(e.target.checked)}/>
|
||||
<label htmlFor="save">{saveCardText}</label>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue