You're currently looking at the string representation of the object, not
all attributes that the
Transaction object has. Try
dir(sale.transaction) to see all the attributes that the
You're most likely looking for the
sale.transaction.order_id attribute (see docs),
depending on whether you want the record/object's identifier or the order
identifier from the customer's perspective.