| Short-term and Long-term Investments |
The Company's short-term and long-term investments as of September 30, 2019 are as follows (in thousands):
| | | | | | | | | | | | | | | | | | Amortized Cost | | Gross Unrealized Gains | | Gross Unrealized Losses | | Fair Value | Short-term debt securities: | | | | | | | | U.S. agency securities | $ | 132,217 |
| | $ | 257 |
| | $ | (126 | ) | | $ | 132,348 |
| Corporate bonds | 55,399 |
| | 194 |
| | (92 | ) | | 55,501 |
| Commercial paper | 2,245 |
| | — |
| | — |
| | 2,245 |
| Municipal securities | 2,713 |
| | 5 |
| | (49 | ) | | 2,669 |
| U.S. government securities | 351,592 |
| | 317 |
| | (192 | ) | | 351,717 |
| Foreign securities | 13,214 |
| | — |
| | (38 | ) | | 13,176 |
| Total | $ | 557,380 |
| | $ | 773 |
| | $ | (497 | ) | | $ | 557,656 |
| | | | | | | | | Long-term debt securities: | | | | | | | | U.S. agency securities | $ | 87,848 |
| | $ | 219 |
| | $ | (164 | ) | | $ | 87,903 |
| Corporate bonds | 185,675 |
| | 286 |
| | (398 | ) | | 185,563 |
| Municipal securities | 12,668 |
| | 12 |
| | (98 | ) | | 12,582 |
| U.S. government securities | 250,434 |
| | 267 |
| | (436 | ) | | 250,265 |
| Foreign securities | 28,264 |
| | 6 |
| | (75 | ) | | 28,195 |
| Total | $ | 564,889 |
| | $ | 790 |
| | $ | (1,171 | ) | | $ | 564,508 |
|
The Company's short-term and long-term investments as of December 31, 2018 are as follows (in thousands):
| | | | | | | | | | | | | | | | | | Amortized Cost | | Gross Unrealized Gains | | Gross Unrealized Losses | | Fair Value | Short-term debt securities: | | | | | | | | U.S. agency securities | $ | 80,160 |
| | $ | 32 |
| | $ | (70 | ) | | $ | 80,122 |
| Corporate bonds | 109,807 |
| | 80 |
| | (368 | ) | | 109,519 |
| Municipal securities | 27,839 |
| | 52 |
| | (59 | ) | | 27,832 |
| U.S. government securities | 292,615 |
| | 161 |
| | (509 | ) | | 292,267 |
| Foreign securities | 31,263 |
| | 4 |
| | (16 | ) | | 31,251 |
| Total | $ | 541,684 |
| | $ | 329 |
| | $ | (1,022 | ) | | $ | 540,991 |
| | | | | | | | | Long-term debt securities: | | | | | | | | U.S. agency securities | $ | 114,444 |
| | $ | 194 |
| | $ | (78 | ) | | $ | 114,560 |
| Corporate bonds | 159,783 |
| | 419 |
| | (950 | ) | | 159,252 |
| Municipal securities | 28,453 |
| | 167 |
| | (26 | ) | | 28,594 |
| U.S. government securities | 153,743 |
| | 553 |
| | (172 | ) | | 154,124 |
| Foreign securities | 8,122 |
| | 28 |
| | — |
| | 8,150 |
| Total | $ | 464,545 |
| | $ | 1,361 |
| | $ | (1,226 | ) | | $ | 464,680 |
|
|
| Contractual Maturities of Short-Term and Long-Term Investments |
The contractual maturities of the Company's short-term and long-term investments as of September 30, 2019 are as follows (in thousands):
| | | | | | | | | | Amortized Cost | | Fair Value | Due in one year or less | $ | 557,380 |
| | $ | 557,656 |
| Due in one to five years | 564,889 |
| | 564,508 |
| Total | $ | 1,122,269 |
| | $ | 1,122,164 |
|
The contractual maturities of the Company's investments within customer funds as of September 30, 2019 are as follows (in thousands):
| | | | | | | | | | Amortized Cost | | Fair Value | Due in one year or less | $ | 223,850 |
| | $ | 223,826 |
| Total | $ | 223,850 |
| | $ | 223,826 |
|
|