Skip to main content
Last updated: 04-Jan-2022
Rate this article:

Overview

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

Input Parameters

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.

Data Returned

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

 

Example API Call

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'

 

Example Successful Response

{
       "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"
          }
       ]
    }

 

Common Error Codes

Code Description
PARAMETER_MISSING Required parameter missing:
PARAMETER_INVALID Invalid value for parameter:
RECORD_NOT_FOUND Unable to find record.
Rate this article:
Logo of Verifone