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

    <schemaVersion>X0306</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2017-04-03</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>2017-04-03</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>M</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>26040</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>53740</value>
                    <footnoteId id="F2"/>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <derivativeTable>
        <derivativeTransaction>
            <securityTitle>
                <value>Performance-Based Restricted Stock Units</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>0</value>
                <footnoteId id="F3"/>
            </conversionOrExercisePrice>
            <transactionDate>
                <value>2017-04-03</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>A</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>26040</value>
                </transactionShares>
                <transactionPricePerShare>
                    <value>0</value>
                    <footnoteId id="F3"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>A</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <exerciseDate>
                <footnoteId id="F3"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F3"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>26040</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>26040</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeTransaction>
        <derivativeTransaction>
            <securityTitle>
                <value>Performance-Based Restricted Stock Units</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <value>0</value>
                <footnoteId id="F3"/>
            </conversionOrExercisePrice>
            <transactionDate>
                <value>2017-04-03</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>M</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>26040</value>
                </transactionShares>
                <transactionPricePerShare>
                    <footnoteId id="F3"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <exerciseDate>
                <footnoteId id="F3"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F3"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>26040</value>
                    <footnoteId id="F1"/>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>0</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>D</value>
                </directOrIndirectOwnership>
            </ownershipNature>
        </derivativeTransaction>
        <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>
    </derivativeTable>

    <footnotes>
        <footnote id="F1">Shares of Class A Common Stock acquired pursuant to the payout of a performance-based restricted stock unit granted to the Reporting Person on February 26, 2014.</footnote>
        <footnote id="F2">The reported amount consists of 27,700 restricted stock units and 26,040 shares of Class A Common Stock.  The restricted stock units are to be settled in an equal number of shares of Class A Common Stock upon vesting</footnote>
        <footnote id="F3">This award vested on April 3, 2017 and the payout of shares of Class A Common Stock pursuant to the award was determined based on the Issuer's total stockholder return (TSR) (50% of the award) and earnings per share (EPS) (50% of the award) for the period of January 1, 2014 through December 31, 2016 as measured against the target performance goals set by the Compensation Committee of the Board of Directors when the award was granted in 2014. The payout percentages for the TSR and EPS portions of the award were 0% and 89.9%, respectively.</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, from and after the closing of PennyMac Financial Services, Inc.'s initial public offering.</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>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Derek W. Stark, attorney-in-fact for Mr. Spector</signatureName>
        <signatureDate>2017-04-05</signatureDate>
    </ownerSignature>
</ownershipDocument>
