Skip to main content
2 of 2
added 6 characters in body

First of all, you cannot override PaymentExtensionInterface - it is generated piece of code.

If you want to define a new field, similar to agreement_ids you should create extension_attributes.xml file in your Company/Module/etc directory with a content like this:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Quote\Api\Data\PaymentInterface">
        <attribute code="subscription_id" type="string" />
    </extension_attributes>
</config>

Getters and setters for subscribtion_id attribute will be generated by Magento and will be present in PaymentExtensionInterface.

You can find more info here: https://devdocs.magento.com/guides/v2.3/howdoi/checkout/checkout_new_field.html

Unfortunately, example in docs is more about shipping than billing step form, but take a look at Magento's checkout-agreements module for some ideas.