Take a Rain Check

What does the idiom “take a rain check” mean?

Definition: Decline an invitation but suggest that you’ll accept it at a later time.

Example: I have to attend a work retreat tonight, so I can’t go out with you. But can I take a rain check?

Note: A rain check is a ticket issued for later admission if a baseball game is “rained out.”