Language

2Checkout Documentation

Refund

You must specify your API username and password using the twocheckout.Api.credentials method before calling a method in this class.

Method

refund

Use to attempt to issue a full, partial or lineitem refund.

Arguments

  • dictionary Parameters
    • Dictionary containing refund_invoice or refund_lineitem parameters. This method can only be called on a sale, invoice or lineitem instance. Parameters -> API Refund Invoice || API Refund Lineitem

Returns

Returns result as a Python object.

Example Usage:

twocheckout.Api.credentials({'username':'APIuser1817037', 'password':'APIpass1817037'})

params = {
    'sale_id': 4834917619,
    'category': 1,
    'comment': "Refunding Sale"
    }

sale = twocheckout.Sale.find(params)
invoice = sale.invoices[0]
lineitem = invoice.lineitems[0]

result = lineitem.refund(params);

Example Response:

{
   'response_code' : 'OK',
   'response_message' : 'lineitem refunded'
}