Skip to content

Mandatory custom field in the payment choice process

I’m trying to add a checkbox in the payment selection process.
The checkbox appears correctly.
I can’t get it to be handled as mandatory.
What am I doing wrong?
This is my code:

$jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']['payment']['children']['payments-list']['children']['before-place-order']['children']['privacy'] = [
    'component' => 'Magento_Ui/js/form/element/abstract',
    'config' => [
        'customScope' => 'billingAddress',
        'template' => 'ui/form/field',
        'elementTmpl' => 'ui/form/element/checkbox',
        'id' => 'privacy'
    ],
    'dataScope' => 'billingAddress',
    'label' => __(''),
    'description' => __('I agree with privacy policy.'),
    'provider' => 'checkoutProvider',
    'visible' => true,
    'validation' => ['required-entry' => true],
    'sortOrder' => 200,
    'id' => 'privacy'
];

Thank you