<?xml version="1.0"?>
<ownershipDocument>

    <schemaVersion>X0306</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2018-04-05</periodOfReport>

    <issuer>
        <issuerCik>0001568669</issuerCik>
        <issuerName>PENNYMAC FINANCIAL SERVICES, INC.</issuerName>
        <issuerTradingSymbol>PFSI</issuerTradingSymbol>
    </issuer>

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001275713</rptOwnerCik>
            <rptOwnerName>SPECTOR DAVID</rptOwnerName>
        </reportingOwnerId>
        <reportingOwnerAddress>
            <rptOwnerStreet1>C/O PENNYMAC FINANCIAL SERVICES, INC.</rptOwnerStreet1>
            <rptOwnerStreet2>3043 TOWNSGATE ROAD</rptOwnerStreet2>
            <rptOwnerCity>WESTLAKE VILLAGE</rptOwnerCity>
            <rptOwnerState>CA</rptOwnerState>
            <rptOwnerZipCode>91361</rptOwnerZipCode>
            <rptOwnerStateDescription></rptOwnerStateDescription>
        </reportingOwnerAddress>
        <reportingOwnerRelationship>
            <isDirector>1</isDirector>
            <isOfficer>1</isOfficer>
            <officerTitle>President &amp; CEO</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Class A Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2018-04-05</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>S</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>10073</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>22.9665</value>
                    <footnoteId id="F2"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>39641</value>
                    <footnoteId id="F3"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <derivativeTable>
        <derivativeHolding>
            <securityTitle>
                <value>Cl A Units of Private Nat'l Mortgage Acceptance Company, LLC</value>
                <footnoteId id="F4"/>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F4"/>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F4"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F4"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>1234125</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>1234125</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Cl A Units of Private Nat'l Mortgage Acceptance Company, LLC</value>
                <footnoteId id="F4"/>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F4"/>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F4"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F4"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>465604</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>465604</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>ST Family Investment Company LLC</value>
                    <footnoteId id="F5"/>
                </natureOfOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Nonstatutory Stock Option (Right to Buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>21.03</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <value>2014-06-13</value>
            </exerciseDate>
            <expirationDate>
                <value>2023-06-12</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>40735</value>
                    <footnoteId id="F6"/>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>40735</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Nonstatutory Stock Option (Right to Buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>17.26</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <value>2015-02-26</value>
            </exerciseDate>
            <expirationDate>
                <value>2024-02-25</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>72301</value>
                    <footnoteId id="F7"/>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>72301</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Nonstatutory Stock Option (Right to Buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>17.52</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <value>2016-03-03</value>
            </exerciseDate>
            <expirationDate>
                <value>2025-03-02</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>61120</value>
                    <footnoteId id="F8"/>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>61120</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Nonstatutory Stock Option (Right to Buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>11.28</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <value>2017-03-07</value>
            </exerciseDate>
            <expirationDate>
                <value>2026-03-06</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>71161</value>
                    <footnoteId id="F9"/>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>71161</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Nonstatutory Stock Option (Right to Buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>18.05</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <value>2018-03-06</value>
            </exerciseDate>
            <expirationDate>
                <value>2027-03-05</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>69252</value>
                    <footnoteId id="F10"/>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>69252</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Nonstatutory Stock Option (Right to Buy)</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>24.40</value>
            </conversionOrExercisePrice>
            <exerciseDate>
                <value>2019-03-09</value>
            </exerciseDate>
            <expirationDate>
                <value>2028-03-08</value>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>52935</value>
                    <footnoteId id="F11"/>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>52935</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeHolding>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">These shares of Class A Common Stock were sold pursuant to a 10b5-1 plan.</footnote>
        <footnote id="F2">The price reported is the weighted average price of multiple transactions ranging from $22.85 to $23.15.  The reporting person hereby undertakes to provide upon request to the SEC, the Issuer or a security holder of the Issuer the number of Class A Common Stock and the prices at which the transactions were effected.</footnote>
        <footnote id="F3">The reported amount consists of 39,641 restricted stock units.  The restricted stock units are to be settled in an equal number of shares of Class A Common Stock upon vesting.</footnote>
        <footnote id="F4">Pursuant to the terms of an exchange agreement, Class A Units of Private National Mortgage Acceptance Company, LLC are exchangeable for shares of Class A Common Stock of PennyMac Financial Services, Inc. on a one-for-one basis, subject to customary conversion rate adjustments.</footnote>
        <footnote id="F5">These securities are held by ST Family Investment Company LLC, of which Mr. Spector is the sole manager. Mr. Spector disclaims beneficial ownership of these securities except to the extent of his pecuniary interest therein, and the inclusion of these shares in this report shall not be deemed an admission of beneficial ownership of all of the reported shares for purposes of Section 16 or for any other purpose.</footnote>
        <footnote id="F6">This nonstatutory stock option to purchase 40,735 shares of Class A Common Stock of the Issuer will vest as to one-third of the optioned shares on each of June 13, 2014, 2015 and 2016, subject to the Reporting Person's continued service through each date.</footnote>
        <footnote id="F7">This nonstatutory stock option to purchase 72,301 shares of Class A Common Stock of the Issuer will vest as to one-third of the optioned shares on each of February 26, 2015, 2016 and 2017, subject to the Reporting Person's continued service through each date.</footnote>
        <footnote id="F8">This nonstatutory stock option to purchase 61,120 shares of Class A Common Stock of the Issuer will vest as to one-third of the optioned shares on each of March 3, 2016, 2017 and 2018, subject to the Reporting Person's continued service through each date.</footnote>
        <footnote id="F9">This nonstatutory stock option to purchase 71,161 shares of Class A Common Stock of the Issuer will vest as to one-third of the optioned shares on each of March 7, 2017, 2018 and 2019, subject to the Reporting Person's committed service through each date.</footnote>
        <footnote id="F10">This nonstatutory stock option to purchase 69,252 shares of Class A Common Stock of the Issuer will vest as to one-third of the optioned shares on each of March 6, 2018, 2019 and 2020, subject to the Reporting Person's committed service through each date.</footnote>
        <footnote id="F11">This nonstatutory stock option to purchase 52,935 shares of Class A Common Stock of the Issuer will vest as to one-third of the optioned shares on each of March 9, 2019, 2020 and 2021, subject to the Reporting Person's committed service through each date.</footnote>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Jeffrey P. Grogin, attorney-in-fact for Mr. Spector</signatureName>
        <signatureDate>2018-04-09</signatureDate>
    </ownerSignature>
</ownershipDocument>
