You can do this using a response object. You can create a response object, store whatever information you need
(Transaction id, time stamp), marshal it into json and then you can return it.
Ex:
type ChaincodeResponse struct {
txID string
time *timestamp.Timestamp
}
// whatever code you have goes here
resp, err := json.Marshal(ChaincodeResponse{
txID: stub.GetTxID(),
time: stub.GetTxTimestamp(),
})
//the below code is used to return
return shim.Success(resp)