Language

2Checkout Documentation

Find

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

Method

find

Use to retrieve a sale object.

Arguments

  • hash Parameters
    • Hash containing a sale_id or invoice_id. Parameters -> API List Sale

Returns

Returns a Sale object.

Example Usage:

Twocheckout::API.credentials = { :username => 'APIuser1817037', :password => 'APIpass1817037' }

sale = Twocheckout::Sale.find(:sale_id => 4786293822)

Example Response:

 {
    "comments"=>[
        {
            "changed_by_ip"=>"66.194.132.135",
            "comment"=>"Recurring billing stopped for Example Product",
            "timestamp"=>"2012-08-18 15:29:57",
            "username"=>"APIuser1817037"
        },
        {
            "changed_by_ip"=>"66.194.132.135",
            "comment"=>"Recurring billing stopped for Example Product",
            "timestamp"=>"2012-08-18 15:29:56",
            "username"=>"APIuser1817037"
        }
    ],
    "customer"=>{
        "address_1"=>"123 Test St",
        "address_2"=>"dddsdsc",
        "address_id"=>"4786293864",
        "cardholder_name"=>"Craig P Christenson",
        "city"=>"Columbus",
        "country_code"=>"USA",
        "country_name"=>"United States",
        "customer_id"=>"4786293828",
        "email_address"=>"christensoncraig@gmail.com",
        "first_name"=>"Craig",
        "lang"=>"en",
        "last_name"=>"Christenson",
        "middle_initial"=>"P",
        "pay_method"=>{
            "avs"=>nil,
            "cvv"=>nil,
            "first_six_digits"=>nil,
            "last_two_digits"=>nil,
            "method"=>"paypal ec"
        },
        "phone"=>"555-555-5555",
        "phone_ext"=>"",
        "postal_code"=>"43123",
        "prefix"=>nil,
        "state"=>"OH"
    },
    "date_placed"=>"2012-08-18 15:25:46",
    "detail_ip"=>{
        "address"=>"66.194.132.135",
        "area_code"=>740,
        "city"=>"Galena",
        "country"=>"United States",
        "country_code"=>"US",
        "region"=>"OH",
        "zip"=>"43021"
    },
    "invoices"=>[
        {
            "customer_total"=>"0.03",
            "date_placed"=>"2012-08-18 15:25:46",
            "date_shipped"=>nil,
            "date_vendor_paid"=>nil,
            "fees_2co"=>"0.46",
            "invoice_id"=>"4786293831",
            "lineitems"=>[
                {
                    "affiliate_vendor_id"=>nil,
                    "billing"=>{
                        "amount"=>"0.01",
                        "bill_method"=>"paypal_int",
                        "billing_id"=>"4786293843",
                        "customer_amount"=>"0.01",
                        "customer_id"=>"4786293828",
                        "date_deposited"=>"2012-08-18",
                        "date_end"=>"1999-01-01",
                        "date_fail"=>"2012-08-25",
                        "date_next"=>"2012-08-25",
                        "date_pending"=>"2012-08-18",
                        "date_start"=>"2012-08-20",
                        "lineitem_id"=>"4786293837",
                        "recurring_status"=>"stopped",
                        "status"=>"bill",
                        "usd_amount"=>"0.01",
                        "vendor_amount"=>"0.01"
                    },
                    "commission"=>nil,
                    "commission_affiliate_vendor_id"=>nil,
                    "commission_flat_rate"=>nil,
                    "commission_percentage"=>nil,
                    "commission_type"=>nil,
                    "commission_usd_amount"=>nil,
                    "customer_amount"=>"0.01",
                    "flat_rate"=>nil,
                    "installment"=>"1",
                    "invoice_id"=>"4786293831",
                    "lc_affiliate_vendor_id"=>nil,
                    "lc_usd_amount"=>nil,
                    "lineitem_id"=>"4786293837",
                    "linked_id"=>nil,
                    "options"=>[
                        
                    ],
                    "percentage"=>nil,
                    "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"=>nil,
                    "product_tangible"=>"0",
                    "sale_id"=>"4786293822",
                    "status"=>"bill",
                    "type"=>nil,
                    "usd_amount"=>"0.01",
                    "usd_commission"=>nil,
                    "vendor_amount"=>"0.01",
                    "vendor_product_id"=>nil
                },
                {
                    "affiliate_vendor_id"=>nil,
                    "billing"=>{
                        "amount"=>"0.01",
                        "bill_method"=>"paypal_int",
                        "billing_id"=>"4786293852",
                        "customer_amount"=>"0.01",
                        "customer_id"=>"4786293828",
                        "date_deposited"=>"2012-08-18",
                        "date_end"=>"1999-01-01",
                        "date_fail"=>"2012-08-25",
                        "date_next"=>"2012-08-25",
                        "date_pending"=>"2012-08-18",
                        "date_start"=>"2012-08-20",
                        "lineitem_id"=>"4786293846",
                        "recurring_status"=>"stopped",
                        "status"=>"bill",
                        "usd_amount"=>"0.01",
                        "vendor_amount"=>"0.01"
                    },
                    "commission"=>nil,
                    "commission_affiliate_vendor_id"=>nil,
                    "commission_flat_rate"=>nil,
                    "commission_percentage"=>nil,
                    "commission_type"=>nil,
                    "commission_usd_amount"=>nil,
                    "customer_amount"=>"0.01",
                    "flat_rate"=>nil,
                    "installment"=>"1",
                    "invoice_id"=>"4786293831",
                    "lc_affiliate_vendor_id"=>nil,
                    "lc_usd_amount"=>nil,
                    "lineitem_id"=>"4786293846",
                    "linked_id"=>nil,
                    "options"=>[
                        
                    ],
                    "percentage"=>nil,
                    "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"=>nil,
                    "product_tangible"=>"0",
                    "sale_id"=>"4786293822",
                    "status"=>"bill",
                    "type"=>nil,
                    "usd_amount"=>"0.01",
                    "usd_commission"=>nil,
                    "vendor_amount"=>"0.01",
                    "vendor_product_id"=>nil
                },
                {
                    "affiliate_vendor_id"=>nil,
                    "billing"=>{
                        "amount"=>"0.01",
                        "bill_method"=>"paypal_int",
                        "billing_id"=>"4786293861",
                        "customer_amount"=>"0.01",
                        "customer_id"=>"4786293828",
                        "date_deposited"=>"2012-08-18",
                        "date_end"=>"1999-01-01",
                        "date_fail"=>"2012-08-25",
                        "date_next"=>"2012-08-25",
                        "date_pending"=>"2012-08-18",
                        "date_start"=>"2012-08-20",
                        "lineitem_id"=>"4786293855",
                        "recurring_status"=>"stopped",
                        "status"=>"bill",
                        "usd_amount"=>"0.01",
                        "vendor_amount"=>"0.01"
                    },
                    "commission"=>nil,
                    "commission_affiliate_vendor_id"=>nil,
                    "commission_flat_rate"=>nil,
                    "commission_percentage"=>nil,
                    "commission_type"=>nil,
                    "commission_usd_amount"=>nil,
                    "customer_amount"=>"0.01",
                    "flat_rate"=>nil,
                    "installment"=>"1",
                    "invoice_id"=>"4786293831",
                    "lc_affiliate_vendor_id"=>nil,
                    "lc_usd_amount"=>nil,
                    "lineitem_id"=>"4786293855",
                    "linked_id"=>nil,
                    "options"=>[
                        
                    ],
                    "percentage"=>nil,
                    "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"=>nil,
                    "product_tangible"=>"0",
                    "sale_id"=>"4786293822",
                    "status"=>"bill",
                    "type"=>nil,
                    "usd_amount"=>"0.01",
                    "usd_commission"=>nil,
                    "vendor_amount"=>"0.01",
                    "vendor_product_id"=>nil
                },
                {
                    "affiliate_vendor_id"=>nil,
                    "billing"=>{
                        "amount"=>"0.01",
                        "bill_method"=>"paypal_int",
                        "billing_id"=>"4789788512",
                        "customer_amount"=>"0.01",
                        "customer_id"=>"4786293828",
                        "date_deposited"=>"2012-08-22",
                        "date_end"=>nil,
                        "date_fail"=>"2012-08-27",
                        "date_next"=>nil,
                        "date_pending"=>"2012-08-22",
                        "date_start"=>"2012-08-22",
                        "lineitem_id"=>"4789788509",
                        "recurring_status"=>nil,
                        "status"=>"refund",
                        "usd_amount"=>"0.01",
                        "vendor_amount"=>"0.01"
                    },
                    "commission"=>nil,
                    "commission_affiliate_vendor_id"=>nil,
                    "commission_flat_rate"=>nil,
                    "commission_percentage"=>nil,
                    "commission_type"=>nil,
                    "commission_usd_amount"=>nil,
                    "customer_amount"=>"0.01",
                    "flat_rate"=>nil,
                    "installment"=>"1",
                    "invoice_id"=>"4786293831",
                    "lc_affiliate_vendor_id"=>nil,
                    "lc_usd_amount"=>nil,
                    "lineitem_id"=>"4789788509",
                    "linked_id"=>"4786293837",
                    "options"=>[
                        
                    ],
                    "percentage"=>nil,
                    "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"=>nil,
                    "product_tangible"=>"0",
                    "sale_id"=>"4786293822",
                    "status"=>"refund",
                    "type"=>nil,
                    "usd_amount"=>"0.01",
                    "usd_commission"=>nil,
                    "vendor_amount"=>"0.01",
                    "vendor_product_id"=>nil
                },
                {
                    "affiliate_vendor_id"=>nil,
                    "billing"=>{
                        "amount"=>"0.01",
                        "bill_method"=>"paypal_int",
                        "billing_id"=>"4789788518",
                        "customer_amount"=>"0.01",
                        "customer_id"=>"4786293828",
                        "date_deposited"=>"2012-08-22",
                        "date_end"=>nil,
                        "date_fail"=>"2012-08-27",
                        "date_next"=>nil,
                        "date_pending"=>"2012-08-22",
                        "date_start"=>"2012-08-22",
                        "lineitem_id"=>"4789788515",
                        "recurring_status"=>nil,
                        "status"=>"refund",
                        "usd_amount"=>"0.01",
                        "vendor_amount"=>"0.01"
                    },
                    "commission"=>nil,
                    "commission_affiliate_vendor_id"=>nil,
                    "commission_flat_rate"=>nil,
                    "commission_percentage"=>nil,
                    "commission_type"=>nil,
                    "commission_usd_amount"=>nil,
                    "customer_amount"=>"0.01",
                    "flat_rate"=>nil,
                    "installment"=>"1",
                    "invoice_id"=>"4786293831",
                    "lc_affiliate_vendor_id"=>nil,
                    "lc_usd_amount"=>nil,
                    "lineitem_id"=>"4789788515",
                    "linked_id"=>"4786293846",
                    "options"=>[
                        
                    ],
                    "percentage"=>nil,
                    "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"=>nil,
                    "product_tangible"=>"0",
                    "sale_id"=>"4786293822",
                    "status"=>"refund",
                    "type"=>nil,
                    "usd_amount"=>"0.01",
                    "usd_commission"=>nil,
                    "vendor_amount"=>"0.01",
                    "vendor_product_id"=>nil
                },
                {
                    "affiliate_vendor_id"=>nil,
                    "billing"=>{
                        "amount"=>"0.01",
                        "bill_method"=>"paypal_int",
                        "billing_id"=>"4789788524",
                        "customer_amount"=>"0.01",
                        "customer_id"=>"4786293828",
                        "date_deposited"=>"2012-08-22",
                        "date_end"=>nil,
                        "date_fail"=>"2012-08-27",
                        "date_next"=>nil,
                        "date_pending"=>"2012-08-22",
                        "date_start"=>"2012-08-22",
                        "lineitem_id"=>"4789788521",
                        "recurring_status"=>nil,
                        "status"=>"refund",
                        "usd_amount"=>"0.01",
                        "vendor_amount"=>"0.01"
                    },
                    "commission"=>nil,
                    "commission_affiliate_vendor_id"=>nil,
                    "commission_flat_rate"=>nil,
                    "commission_percentage"=>nil,
                    "commission_type"=>nil,
                    "commission_usd_amount"=>nil,
                    "customer_amount"=>"0.01",
                    "flat_rate"=>nil,
                    "installment"=>"1",
                    "invoice_id"=>"4786293831",
                    "lc_affiliate_vendor_id"=>nil,
                    "lc_usd_amount"=>nil,
                    "lineitem_id"=>"4789788521",
                    "linked_id"=>"4786293855",
                    "options"=>[
                        
                    ],
                    "percentage"=>nil,
                    "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"=>nil,
                    "product_tangible"=>"0",
                    "sale_id"=>"4786293822",
                    "status"=>"refund",
                    "type"=>nil,
                    "usd_amount"=>"0.01",
                    "usd_commission"=>nil,
                    "vendor_amount"=>"0.01",
                    "vendor_product_id"=>nil
                }
            ],
            "recurring"=>"1",
            "referrer"=>"https://www.2checkout.com/va/products/detail_html_snippet?product_id=4774387610",
            "sale_id"=>"4786293822",
            "shipping"=>nil,
            "status"=>"deposited",
            "usd_total"=>"0.03",
            "vendor_id"=>"1817037",
            "vendor_order_id"=>nil,
            "vendor_total"=>"0.03"
        }
    ],
    "ip_address"=>"66.194.132.135",
    "ip_country"=>"United States",
    "recurring_decline"=>nil,
    "sale_id"=>"4786293822"
}