Language

2Checkout Documentation

Retrieve

You must specify your API username and password using the Twocheckout.apiusername & Twocheckout.apipassword class variables before calling a method in this class.

Method

retrieve

Use to retrieve a sale.

Arguments

  • hash Parameters
    • Hash containing list_sale parameters or sale_id/invoice_id. Parameters -> API List Sales

Returns

Returns a Sale object.

Example Usage:

Sale sale = TwocheckoutSale.retrieve("4774380224");

Example Response (toJson):

{
   "response_code" : "OK",
   "response_message" : "Sale detail retrieved",
   "sale" : {
      "comments" : [
         {
            "changed_by_ip" : "66.194.132.135",
            "comment" : "Refund Issued On Invoice: Refunding Sale",
            "timestamp" : "2012-08-04 15:38:02",
            "username" : "APIuser1817037"
         }
      ],
      "customer" : {
         "address_1" : "​855 Grandview Avenue",
         "address_2" : "Suite 11",
         "address_id" : "4774467650",
         "cardholder_name" : "Testing  Tester",
         "city" : "Columbus",
         "country_code" : "USA",
         "country_name" : "United States",
         "customer_id" : "4774467602",
         "email_address" : "no-reply@2co.com",
         "first_name" : "Testing",
         "lang" : "en",
         "last_name" : "Tester",
         "middle_initial" : null,
         "pay_method" : {
            "avs" : null,
            "cvv" : null,
            "first_six_digits" : null,
            "last_two_digits" : null,
            "method" : "paypal ec"
         },
         "phone" : "6149212450",
         "phone_ext" : "",
         "postal_code" : "43215",
         "prefix" : null,
         "state" : "OH"
      },
      "date_placed" : "2012-08-04 15:36:04",
      "detail_ip" : {
         "address" : "???",
         "area_code" : "???",
         "city" : "???",
         "country" : "Unknown",
         "country_code" : "???",
         "zip" : "???"
      },
      "invoices" : [
         {
            "customer_total" : "0.01",
            "date_placed" : "2012-08-04 15:36:04",
            "date_shipped" : "2012-08-04 15:36:04",
            "date_vendor_paid" : null,
            "fees_2co" : "0.46",
            "invoice_id" : "4774467605",
            "lineitems" : [
               {
                  "affiliate_vendor_id" : null,
                  "billing" : {
                     "amount" : "0.01",
                     "bill_method" : "paypal_int",
                     "billing_id" : "4774467647",
                     "customer_amount" : "0.01",
                     "customer_id" : "4774467602",
                     "date_deposited" : null,
                     "date_end" : null,
                     "date_fail" : "2012-08-11",
                     "date_next" : "2012-08-11",
                     "date_pending" : "2012-08-04",
                     "date_start" : "2012-08-06",
                     "lineitem_id" : "4774467641",
                     "recurring_status" : "active",
                     "status" : "bill",
                     "usd_amount" : "0.01",
                     "vendor_amount" : "0.01"
                  },
                  "commission" : null,
                  "commission_affiliate_vendor_id" : null,
                  "commission_flat_rate" : null,
                  "commission_percentage" : null,
                  "commission_type" : null,
                  "commission_usd_amount" : null,
                  "customer_amount" : "0.01",
                  "flat_rate" : null,
                  "installment" : "1",
                  "invoice_id" : "4774467605",
                  "lc_affiliate_vendor_id" : null,
                  "lc_usd_amount" : null,
                  "lineitem_id" : "4774467641",
                  "linked_id" : null,
                  "options" : [],
                  "percentage" : null,
                  "product_description" : "",
                  "product_duration" : "Forever",
                  "product_handling" : "0.00",
                  "product_id" : "4774387610",
                  "product_is_cart" : "0",
                  "product_name" : "Example Product",
                  "product_price" : "0.01",
                  "product_recurrence" : "1 Week",
                  "product_startup_fee" : null,
                  "product_tangible" : "0",
                  "sale_id" : "4774467596",
                  "status" : "bill",
                  "type" : null,
                  "usd_amount" : "0.01",
                  "usd_commission" : null,
                  "vendor_amount" : "0.01",
                  "vendor_product_id" : null
               },
               {
                  "affiliate_vendor_id" : null,
                  "billing" : {
                     "amount" : "0.01",
                     "bill_method" : "paypal_int",
                     "billing_id" : "4774468787",
                     "customer_amount" : "0.01",
                     "customer_id" : "4774467602",
                     "date_deposited" : null,
                     "date_end" : null,
                     "date_fail" : "2012-08-09",
                     "date_next" : null,
                     "date_pending" : null,
                     "date_start" : "2012-08-04",
                     "lineitem_id" : "4774468784",
                     "recurring_status" : null,
                     "status" : "refund",
                     "usd_amount" : "0.01",
                     "vendor_amount" : "0.01"
                  },
                  "commission" : null,
                  "commission_affiliate_vendor_id" : null,
                  "commission_flat_rate" : null,
                  "commission_percentage" : null,
                  "commission_type" : null,
                  "commission_usd_amount" : null,
                  "customer_amount" : "0.01",
                  "flat_rate" : null,
                  "installment" : "1",
                  "invoice_id" : "4774467605",
                  "lc_affiliate_vendor_id" : null,
                  "lc_usd_amount" : null,
                  "lineitem_id" : "4774468784",
                  "linked_id" : "4774467641",
                  "options" : [],
                  "percentage" : null,
                  "product_description" : "",
                  "product_duration" : "Forever",
                  "product_handling" : "0.00",
                  "product_id" : "4774387610",
                  "product_is_cart" : "0",
                  "product_name" : "Example Product",
                  "product_price" : "0.01",
                  "product_recurrence" : "1 Week",
                  "product_startup_fee" : null,
                  "product_tangible" : "0",
                  "sale_id" : "4774467596",
                  "status" : "refund",
                  "type" : null,
                  "usd_amount" : "0.01",
                  "usd_commission" : null,
                  "vendor_amount" : "0.01",
                  "vendor_product_id" : null
               }
            ],
            "recurring" : "1",
            "referrer" : "http://sputnik.2checkout.com/handy/",
            "sale_id" : "4774467596",
            "shipping" : {
               "address_1" : "​855 Grandview Avenue",
               "address_2" : "Suite 11",
               "city" : "Columbus",
               "country_code" : "USA",
               "country_name" : "United States",
               "date_shipped" : "2012-08-04 15:36:04",
               "invoice_id" : "4774467605",
               "postal_code" : "43215",
               "shipping_address_id" : "4774467659",
               "shipping_id" : "4774467638",
               "shipping_method_id" : null,
               "shipping_method_name" : "N/A",
               "shipping_name" : "Testing Tester",
               "state" : "OH",
               "tracking_number" : null,
               "tracking_url" : null
            },
            "status" : "pending",
            "usd_total" : "0.01",
            "vendor_id" : "1817037",
            "vendor_order_id" : null,
            "vendor_total" : "0.01"
         }
      ],
      "ip_address" : "192.168.2.201",
      "ip_country" : "Unknown",
      "recurring_decline" : null,
      "sale_id" : "4774467596"
   }
}