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

    <schemaVersion>X0306</schemaVersion>

    <documentType>4</documentType>

    <periodOfReport>2017-02-24</periodOfReport>

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

    <reportingOwner>
        <reportingOwnerId>
            <rptOwnerCik>0001440697</rptOwnerCik>
            <rptOwnerName>Grogin Jeffrey</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>
            <isOfficer>1</isOfficer>
            <officerTitle>CALO</officerTitle>
        </reportingOwnerRelationship>
    </reportingOwner>

    <nonDerivativeTable>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Class A Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2017-02-24</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>S</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>3000</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>18.1725</value>
                    <footnoteId id="F2"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>6000</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>The Grogin Living Trust dtd 12-19-01</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Class A Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2017-02-27</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>S</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>3000</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>18.105</value>
                    <footnoteId id="F3"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>3000</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>The Grogin Living Trust dtd 12-19-01</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
        <nonDerivativeTransaction>
            <securityTitle>
                <value>Class A Common Stock</value>
            </securityTitle>
            <transactionDate>
                <value>2017-02-28</value>
            </transactionDate>
            <transactionCoding>
                <transactionFormType>4</transactionFormType>
                <transactionCode>S</transactionCode>
                <equitySwapInvolved>0</equitySwapInvolved>
            </transactionCoding>
            <transactionTimeliness></transactionTimeliness>
            <transactionAmounts>
                <transactionShares>
                    <value>3000</value>
                    <footnoteId id="F1"/>
                </transactionShares>
                <transactionPricePerShare>
                    <value>17.8947</value>
                    <footnoteId id="F4"/>
                </transactionPricePerShare>
                <transactionAcquiredDisposedCode>
                    <value>D</value>
                </transactionAcquiredDisposedCode>
            </transactionAmounts>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>0</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>The Grogin Living Trust dtd 12-19-01</value>
                </natureOfOwnership>
            </ownershipNature>
        </nonDerivativeTransaction>
    </nonDerivativeTable>

    <derivativeTable>
        <derivativeHolding>
            <securityTitle>
                <value>Cl A Units of Private Nat'l Mortgage Acceptance Company, LLC</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F5"/>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F5"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F5"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>632580</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>632580</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>The Grogin Living Trust dtd 12-19-01</value>
                </natureOfOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Cl A Units of Private Nat'l Mortgage Acceptance Company, LLC</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F5"/>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F5"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F5"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>33193</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>33193</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>JBG Children's Trust utd 12/31/2000</value>
                </natureOfOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Cl A Units of Private Nat'l Mortgage Acceptance Company, LLC</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F5"/>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F5"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F5"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>22128.73</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>22128.73</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>MJG Children's Trust utd 12/31/2000</value>
                </natureOfOwnership>
            </ownershipNature>
        </derivativeHolding>
        <derivativeHolding>
            <securityTitle>
                <value>Cl A Units of Private Nat'l Mortgage Acceptance Company, LLC</value>
            </securityTitle>
            <conversionOrExercisePrice>
                <footnoteId id="F5"/>
            </conversionOrExercisePrice>
            <exerciseDate>
                <footnoteId id="F5"/>
            </exerciseDate>
            <expirationDate>
                <footnoteId id="F5"/>
            </expirationDate>
            <underlyingSecurity>
                <underlyingSecurityTitle>
                    <value>Class A Common Stock</value>
                </underlyingSecurityTitle>
                <underlyingSecurityShares>
                    <value>11064.27</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>11064.27</value>
                </sharesOwnedFollowingTransaction>
            </postTransactionAmounts>
            <ownershipNature>
                <directOrIndirectOwnership>
                    <value>I</value>
                </directOrIndirectOwnership>
                <natureOfOwnership>
                    <value>Adult Daughter</value>
                </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>15882</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>15882</value>
                    <footnoteId id="F6"/>
                </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>28216</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>28216</value>
                    <footnoteId id="F7"/>
                </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>23829</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>23829</value>
                    <footnoteId id="F8"/>
                </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>27771</value>
                </underlyingSecurityShares>
            </underlyingSecurity>
            <postTransactionAmounts>
                <sharesOwnedFollowingTransaction>
                    <value>27771</value>
                    <footnoteId id="F9"/>
                </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 $18.05 to $18.25.  The reporting person hereby undertakes to provide upon request to the SEC, the Issuer or a security holder of the Issuer the number of common shares of beneficial interest and the prices at which the transactions were effected.</footnote>
        <footnote id="F3">The price reported is the weighted average price of multiple transactions ranging from $18.05 to $18.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 common shares of beneficial interest and the prices at which the transactions were effected.</footnote>
        <footnote id="F4">The price reported is the weighted average price of multiple transactions ranging from $17.75 to $18.00.  The reporting person hereby undertakes to provide upon request to the SEC, the Issuer or a security holder of the Issuer the number of common shares of beneficial interest and the prices at which the transactions were effected.</footnote>
        <footnote id="F5">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 the Issuer on a one-for-one basis, subject to customary conversion rate adjustments.</footnote>
        <footnote id="F6">This nonstatutory stock option to purchase 15,882 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 28,216 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 23,829 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 committed service through each date.</footnote>
        <footnote id="F9">This nonstatutory stock option to purchase 27,771 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>
    </footnotes>

    <ownerSignature>
        <signatureName>/s/ Jeffrey Grogin</signatureName>
        <signatureDate>2017-02-28</signatureDate>
    </ownerSignature>
</ownershipDocument>
