Google Analytics has a data import feature, however the only import type that ties to a transaction id is refund data (which will not allow you to attach a discount code to the transaction). I would suggest a workaround, but can give no real guarantee that it will actually work (since data imports take a while to process this would take a long time to test).
Data imports need a key field within GA, with the same key in the data you want to import from an external source.
One of the data import types is "custom data". With that you can use a custom dimension as key. For that you need to create two custom dimensions - for examples sake I'll call them "key" and "coupon", both are hit scoped.
Next you have to set up a advanced filter in your view settings. If the request url matches the confirmation page you extract the transaction id and copy it (via "Output to constructor") to the custom dimension "key".
Next you go to property settings -> data import -> new data set -> type "custom data".
Give the data set a name, attach a view. In the data schema setting select "custom dimensions->key" as key field. In the imported data field select "custom dimensions->coupon" (as created above). Select "overwrite hit data". Download the data schema.
Prepare the data you want to import. In the data schema file fill the first column with the transaction ids. In the second column fill the rows with coupon code per transaction where applicable.
Go to your data import, click "manage uploads" and upload your file. Wait 24 hours until the data is processed. If things work as hoped the pageviews for the transactions will now have the custom dimension with the coupon id attached (if applicable, else it will simply be empty). I.e. the dimension will still not be tied to the transaction id, but at least to the pageview where the transaction took place, so that's the next best thing.
As I've said that's untested, but I do not see any particular reason why it wouldn't work, even if it's quite a roundabout way.