When you trade-in at a physical Apple Store, assuming that the iPad is accepted, you will be offered instant credit (to be used immediately against a purchase), or as an Apple Gift Card that can be redeemed against a future purchase from Apple.
If a trade-in is initiated during an online purchase, you will be sent a shipping kit with which to return your old device to Apple's trade-in Partner. When using this method, you will initially pay the full purchase price against your chosen payment method - but will be subsequently refunded the trade-in value, to the original payment method, when your device is received and assessed by the trade-in Partner.
A stand-alone trade-in - as you seemingly describe - will result in you receiving an Apple Gift Card. The trade-in value cannot be applied retrospectively, as a refund, to an earlier device purchase.
You should note that Apple Gift Cards do not expire - and can be redeemed against a future purchase from Apple, or for Apple Services (e.g., Apple Music, iCloud+, AppleTV+ etc.)