protected function _setPayment($sPaymentid)
    {
        $oPayment = oxNew(\OxidEsales\Eshop\Application\Model\Payment::class);

        if (!$oPayment->load($sPaymentid)) {
            return null;
        }

        $aDynvalue = $this->getDynamicValues();

        $oPayment->setDynValues(\OxidEsales\Eshop\Core\Registry::getUtils()->assignValuesFromText($oPayment->oxpayments__oxvaldesc->value));

        // collecting dynamic values
        $aDynVal = [];

        if (is_array($aPaymentDynValues = $oPayment->getDynValues())) {
            foreach ($aPaymentDynValues as $key => $oVal) {
                if (isset($aDynvalue[$oVal->name])) {
                    $oVal->value = $aDynvalue[$oVal->name];
                }

                //$oPayment->setDynValue($key, $oVal);
                $aPaymentDynValues[$key] = $oVal;
                $aDynVal[$oVal->name] = $oVal->value;
            }
        }

        // Store this payment information, we might allow users later to
        // reactivate already give payment information

        $oUserpayment = oxNew(\OxidEsales\Eshop\Application\Model\UserPayment::class);
        $oUserpayment->oxuserpayments__oxuserid = clone $this->oxorder__oxuserid;
        $oUserpayment->oxuserpayments__oxpaymentsid = new \OxidEsales\Eshop\Core\Field($sPaymentid, \OxidEsales\Eshop\Core\Field::T_RAW);
        $oUserpayment->oxuserpayments__oxvalue = new \OxidEsales\Eshop\Core\Field(\OxidEsales\Eshop\Core\Registry::getUtils()->assignValuesToText($aDynVal), \OxidEsales\Eshop\Core\Field::T_RAW);
        $oUserpayment->oxpayments__oxdesc = clone $oPayment->oxpayments__oxdesc;
        $oUserpayment->oxpayments__oxlongdesc = clone $oPayment->oxpayments__oxlongdesc;
        $oUserpayment->setDynValues($aPaymentDynValues);
        $oUserpayment->save();

        // storing payment information to order
        $this->oxorder__oxpaymentid = new \OxidEsales\Eshop\Core\Field($oUserpayment->getId(), \OxidEsales\Eshop\Core\Field::T_RAW);
        $this->oxorder__oxpaymenttype = clone $oUserpayment->oxuserpayments__oxpaymentsid;

        // returning user payment object which will be used later in code ...
        return $oUserpayment;
    }