cancel
Showing results for 
Search instead for 
Did you mean: 

How to save custom payment method data in Table?

How to save custom payment method data in Table?

I have created a custom payment extension, it has 2 Textbox, display at frontend, in the payment section, so now my question is,

how can I store that textbox data in the database?

I use 2 tables for that, quote_paymentsales_order_payment and table field is ->  tax_relief_codetax_relief_state in both table,

 

dCDXt

 

those 2 textbox created in html file, path is app/code/Fms/Taxrelief/view/frontend/web/template/payment/taxrelief.html

 

<div class="customer-tax-relief" data-bind="css: {'_active': (getCode() == isChecked())}">
    <div class="customer-tax-relief-info field choice">
        <input type="checkbox"
               name="payment[method]"
               class="checkbox"
               data-bind="attr: {'id': getCode()}, value: getCode(), checked: isChecked, click: selectPaymentMethod, visible: isRadioButtonVisible()"/>
        <label data-bind="attr: {'for': getCode()}" class="label"><span data-bind="text: getTitle()"></span></label>
    </div>
    <div class="customer-tax-relief-content">
     <!-- ko foreach: getRegion('messages') -->
        <!-- ko template: getTemplate() --><!-- /ko -->
        <!--/ko-->
        <div class="customer-tax-relief-billing-address">
            <!-- ko foreach: $parent.getRegion(getBillingAddressFormName()) -->
            <!-- ko template: getTemplate() --><!-- /ko -->
            <!--/ko-->
        </div>
		
		<form class="form" data-bind="attr: {'id': getCode() + '-form'}">            
			<div class="input-box">
			<label class="label">
				<span><!-- ko i18n: 'Tax Exempt Number *'--><!-- /ko --></span>
			</label>
				<input id="customer-tax-relief-code" 
					   name="payment[tax_relief_code]" 
					   type="text" 
					   class="input-text" 
					   data-validate="{'required-entry':true}"
					   autocomplete="off">
			</div>
			<label class="label">
				<span><!-- ko i18n: 'Tax Exempt State *'--><!-- /ko --></span>
			</label>
			<div class="input-box">
				<input id="customer-tax-relief-state" 
					   name="payment[tax_relief_state]" 
					   type="text" 
					   class="input-text" 
					   data-validate="{'required-entry':true}"
					   autocomplete="off">
			</div>
        </form>
		  
        <div class="checkout-agreements-block">
            <!-- ko foreach: $parent.getRegion('before-place-order') -->
                <!-- ko template: getTemplate() --><!-- /ko -->
            <!--/ko-->
        </div>
        <!--<div class="actions-toolbar">
            <div class="primary">
                <button class="action primary checkout"
                        type="submit"
                        data-bind="
                        click: placeOrder,
                        attr: {title: $t('Place Order')},
                        css: {disabled: !isPlaceOrderActionAllowed()},
                        enable: (getCode() == isChecked())
                        "
                        disabled>
                    <span data-bind="i18n: 'Place Order'"></span>
                </button>
            </div>
        </div>-->
    </div>
</div>