The list_sales call is used to retrieve a summary of all sales or only those matching a variety of sale attributes.
URL: https://www.2checkout.com/api/sales/list_sales
HTTP Method: GET
Parameter | Description |
---|---|
sale_id | Search for sale with this Sale ID. Optional. |
invoice_id | Search for a Sale with this Invoice ID. Optional. |
customer_name | Search for sales with this cardholder name. Must be at least 3 chars and can be substring of cardholder name. Case Insensitive. Optional. |
customer_email | Search for sales with this buyer email. Can be substring of the email. Case insensitive. Optional. |
customer_phone | Search for sales with this phone number. Can be an incomplete number but must match from the beginning. Optional. |
vendor_product_id | Search for sales with this product id. Can be substring of the id. Optional. |
ccard_first6 | Search for sales with these First 6 numbers of the credit card number. Optional. |
ccard_last2 | Search for sales with these Last 2 numbers of the credit card number. Optional. |
sale_date_begin | Search for sales from this date to current date (or sale_date_end). Optional. |
sale_date_end | Search for sales from beginning of time (or sale_date_begin) to this date. Optional. |
declined_recurrings | Search for declined recurring sales. Optional. |
active_recurrings | Search for active recurring sales. Optional. |
refunded | Search for sales that have been refunded in full or partially. Optional. |
cur_page | The page number to retrieve. First page = 1. Optional. |
pagesize | Total rows per page. Possible values are 1-100. If pagesize not specified, default of 20 items per page will be assigned internally. Optional. |
sort_col | The name of the column to sort on. Possibile values are sale_id, date_placed, customer_name, recurring, recurring_declined and usd_total. (case insensitive) Optional. |
sort_dir | The direction of the sort process. (‘ASC’ or ‘DESC’) (case insensitive) Optional. |
Parameter | Description |
---|---|
sale_id | Order number/Sale Number |
date_placed | Date the order was placed |
customer_name | Buyer name |
recurring | Is the order recurring (values: 0=No, 1=Yes) |
recurring_declined | Date of most recent recurring decline |
decline_code | Decline code of most recent recurring decline |
usd_total | Buyer total in USD |
sale_url | Direct url to sale detail page |
Twocheckout::username('testlibraryapi901248204'); Twocheckout::password('testlibraryapi901248204PASS'); // Twocheckout::sandbox(true); #Uncomment to use Sandbox $args = array( 'pagesize' => 10 ); try { $result = Twocheckout_Sale::retrieve($args); } catch (Twocheckout_Error $e) { $e->getMessage(); }
Twocheckout::API.credentials = { :username => 'APIuser1817037', :password => 'APIpass1817037', # :sandbox => 1 #Uncomment to use Sandbox } begin sale_list = Twocheckout::Sale.list(:pagesize => 3) rescue Exception => e puts e.message end
var tco = new Twocheckout({ apiUser: "APIuser1817037", apiPass: "APIpass1817037", sandbox: false }); args = { pagesize: "10" }; tco.sales.list(args, function (error, data) { if (error) { console.log(error); } else { console.log(data.response_code); } });
twocheckout.Api.auth_credentials({ 'username': APIuser1817037', 'password': 'APIpass1817037', # 'mode': 'sandbox' #Uncomment to use Sandbox }) params = { 'pagesize': 10 } try: sale = twocheckout.Sale.list(params) except TwocheckoutError as error: print error.message
TwoCheckoutConfig.ApiUsername = "APIuser1817037"; TwoCheckoutConfig.ApiPassword = "APIpass1817037"; // TwoCheckoutConfig.Sandbox = true; #Uncomment to use Sandbox try { var ServiceObject = new SaleService(); var ArgsObject = new SaleListServiceOptions(); ArgsObject.customer_email = "noreply@2co.com"; var result = ServiceObject.List(ArgsObject); Console.Write(result); } catch (TwoCheckoutException e) { Console.Write(e); }
TwoCheckoutConfig.ApiUsername = "APIuser1817037"; TwoCheckoutConfig.ApiPassword = "APIpass1817037"; // Twocheckout.mode = "sandbox"; #Uncomment to use Sandbox try { HashMap params = new HashMap(); params.put("pagesize", "3"); SaleList response = TwocheckoutSale.list(params); } catch (TwocheckoutException e) { String message = e.toString(); }
curl -G https://www.2checkout.com/api/sales/list_sales \ -H 'Accept: application/json' -u 'username:password' \ -d 'sort_col=date_placed' -d 'sort_dir=desc'
{ "page_info" : { "cur_page" : "1", "first_entry" : 1, "first_page" : 1, "first_page_url" : "https://www.2checkout.com/api/sales/list_sales?cur_page=1", "last_entry" : "4", "last_page" : 1, "last_page_url" : "https://www.2checkout.com/api/sales/list_sales?cur_page=1", "next_page" : null, "pagesize" : "20", "previous_page" : null, "total_entries" : "4" }, "response_code" : "OK", "response_message" : "Sales summaries retrieved successfully.", "sale_summary" : [ { "customer_name" : "Testing Tester", "date_placed" : "2012-03-30", "decline_code" : null, "recurring" : "0", "recurring_declined" : null, "sale_id" : "4672226243", "sale_url" : "https://www.2checkout.com/api/sales/detail_sale?sale_id=4672226243", "usd_total" : "2.00" }, { "customer_name" : "Testing Tester", "date_placed" : "2012-03-30", "decline_code" : null, "recurring" : "0", "recurring_declined" : null, "sale_id" : "4672223284", "sale_url" : "https://www.2checkout.com/api/sales/detail_sale?sale_id=4672223284", "usd_total" : "2.00" }, { "customer_name" : "Testing Tester", "date_placed" : "2012-03-27", "decline_code" : null, "recurring" : "0", "recurring_declined" : null, "sale_id" : "4669698261", "sale_url" : "https://www.2checkout.com/api/sales/detail_sale?sale_id=4669698261", "usd_total" : "1.00" }, { "customer_name" : "Testing Tester", "date_placed" : "2012-03-26", "decline_code" : null, "recurring" : "0", "recurring_declined" : null, "sale_id" : "4669135919", "sale_url" : "https://www.2checkout.com/api/sales/detail_sale?sale_id=4669135919", "usd_total" : "1.00" } ] }
Code | Description |
---|---|
PARAMETER_MISSING | Required parameter missing: |
PARAMETER_INVALID | Invalid value for parameter: |
RECORD_NOT_FOUND | Unable to find record. |