The pay/getBilling method is an Elance Developer API Pay method that returns a billing object for the supplied invoice ID.

A billing instance consists of an invoice (InvoiceData object), an array of invoice details (InvoiceDetailsData object), a log of associated invoicing activity (InvoiceActivityData object), and an array detailing the payments made by the client to the provider (PaymentData object). Billing IDs are obtained from one of two sources:

  1. The invoiceId parameter of the TimesheetData object, which is returned by the API methods pay/getTimesheetsForBid and pay/getTimesheet.
  2. The invoiceIds array of the StatusReportData object, which is returned by the API methods pay/getStatusReportsForBid and pay/getStatusReport.

pay/getBilling is an authenticated method. It requires a Developer API key and an OAuth Consumer Secret, both issued by Elance. It is invoked using an HTTP or HTTPS GET request. For more details on the OAuth authentication protocol, see Using OAuth with Authenticated Methods.

This method does not support the JSONP response format.

For more information on the format of an Elance Developer API request, see Getting Started.

tableofcontents_number_textRequired Query String Parameters

Parameter Data Type Description
id integer The unique ID, assigned by Elance, to the requested billing object. This is the invoiceId property returned by methods such as pay/getStatusReportsForBid, pay/getTimesheetsForBid, pay/getStatusReport, and pay/getTimesheet.

tableofcontents_number_textResponse Data Description

Property Data Type Description
bidDetails BidData object The details regarding this bid and associated Workroom, including project name, client, and provider.
invoice InvoiceData object Basic information about the invoice, including the amount and the currency used.
invoiceDetails array of InvoiceDetailsData object A billable instance of work activity. Includes the rate, hours, and amount billed.
invoiceActivity array of InvoiceActivityData objects A record of all payments made against this invoice. Includes associated comments for the payment, and (if applicable) a paymentId parameter that refers to a PaymentData object.
payments array of PaymentData objects A record of the actual physical payment made by the client to the provider.

tableofcontents_number_textRequest/Response Examples in JSON

tableofcontents_number_textRetrieving a Billing Record

The following HTTP GET request demonstrates retrieving a specific billing record using its invoice ID. The HTTP headers for the GET request are shown below. (NOTE: Elance recommends that developers access OAuth APIs using one of the many publicly available libraries.)

tableofcontents_number_textRequest

GET /api/pay/getBilling?id=6730313 HTTP/1.1
User-Agent: anyMeta/OAuth 1.0 - ($LastChangedRevision: 134 $)
Host: api.elance.com
Accept: */*
Authorization: OAuth realm="",oauth_signature_method="HMAC-SHA1",oauth_signature="YHpUKkLbUI6B%2B%2BUwY54rFpml2wk%3D",oauth_nonce="4c8bba92d8a91",oauth_timestamp="1284225682",oauth_token="988078256-1425962-1425962-76.99.193-fd76b324028bef6-%2B",oauth_consumer_key="8cfc475b57fee5b7dc08cc0f1d5a0fcdab409b3c",oauth_version="1.0"

tableofcontents_number_textResponse

{
    "api" : "pay\/getBilling",
    "apiVersion" : 1,
    "rcode" : 1,
    "data" :  {
        "bidDetails" :  {
            "bidId" : "24170489",
            "jobId" : "24170488",
            "jobName" : "PHP scripting for SuperGeeks",
            "userType" : "PROVIDER",
            "clientUserId" : "1969228",
            "clientName" : "SuperGeeks",
            "clientImageURL" : "https : \/\/www.elance.com\/file\/SG_logo100x100.jpg?crypted=Y3R4JTNEc2VhcmNoX3RodW1ibmFpbCUyNmZpZCUzRDIwMzEwMTczJTI2cmlkJTNELTElMjZwaWQlM0QxOTY5MjI4",
            "clientCountry" : "United States",
            "clientCountryCode" : "US",
            "clientCity" : "Honolulu",
            "providerUserId" : "1976925",
            "providerName" : "John Smith",
            "providerImageURL" : "https : \/\/www.elance.com\/file\/cry_face_4056.jpg?crypted=Y3R4JTNEc2VhcmNoX3RodW1ibmFpbCUyNmZpZCUzRDMwMTAxODEyJTI2cmlkJTNELTElMjZwaWQlM0QxOTc2OTI1",
            "providerCountry" : "United States",
            "providerCountryCode" : "US",
            "providerCity" : "Mountain View",
            "phase" : "5",
            "status" : "Working",
            "secondaryStatus" : "",
            "isHourly" : false,
            "isSponsored" : false,
            "isPreBid" : false,
            "bidAmount" : "200",
            "hoursPerWeek" : "0",
            "duration" : "",
            "submissionDate" : 1306900800
        },
        "billing" :  {
            "invoice" :  {
                "id" : 6730313,
                "date" : 1306900800,
                "bidId" : 24170489,
                "jobId" : 24170488,
                "client" : "SuperGeeks",
                "provider" : "johnsmithinc",
                "clientUserId" : 1969228,
                "providerUserId" : 1976925,
                "type" : "Invoice",
                "status" : "Released",
                "amountBilled" : 200,
                "amountPaid" : 200,
                "amountOutstanding" : 0,
                "currency" : "USD",
                "comments" : "",
                "lineItemCount" : 0,
                "paymentIds" : [10396168]
            } ,
            "invoiceDetails" :  {
                "0" :  {
                "parentId" : 6730313,
                "description" : " ",
                "type" : "Milestone",
                "milestoneId" : 3751624,
                "milestoneDescription" : "Final Deliverable",
                "rate" : 0,
                "hours" : 0,
                "amount" : 200
                }
            } ,
            "invoiceActivity" :  {
                "0" :  {
                    "parentId" : 6730313,
                    "activity" : "Released",
                    "user" : "SuperGeeks",
                    "date" : 1306900800,
                    "comments" : "$200.00 has been released from escrow to the provider.",
                    "paymentId" : 10396168
                } ,
                "1" :  {
                    "parentId" : 6730313,
                    "activity" : "Release Request Sent",
                    "user" : "johnsmithinc",
                    "date" : 1306900800,
                    "comments" : "",
                    "paymentId" : 0
                }
            } ,
            "payments" :  {
            "0" :  {
                "id" : 10396168,
                "date" : 1306900800,
                "bidId" : 24170489,
                "jobId" : 24170488,
                "client" : "SuperGeeks",
                "provider" : "johnsmithinc",
                "clientUserId" : 1969228,
                "providerUserId" : 1976925,
                "fromAccountId" : 2,
                "toAccountId" : 2214625,
                "invoiceId" : 6730313,
                "internalPaymentDisplay" : "Elance Escrow",
                "externalPaymentId" : 0,
                "externalPaymentDisplay" : "",
                "fromAmount" : 200,
                "fromCurrency" : "USD",
                "toAmount" : 200,
                "toCurrency" : "USD",
                "amount" : 200,
                "fromDescription" : "Release of Payment for PHP scripting for SuperGeeks to johnsmithinc from Escrow Account for project bid ID 24170489.   Document #6730313",
                "toDescription" : "Release of Payment for PHP scripting for SuperGeeks from Escrow Account for project bid ID 24170489.   Document #6730313"
            }
       }
    }
} 

tableofcontents_number_textError Codes

For a list of other common errors that can be thrown by this method, see Common API Error Codes.