try: sale = twocheckout.Sale.find(EXAMPLE_SALE) invoice = sale.invoices[0] lineitem = invoice.lineitems[0] result = lineitem.refund(EXAMPLE_REFUND) except TwocheckoutError as error: error.message