Authorize Quote

Resource:
/api/quote/<<quote id>>/authorize
Method:
POST

This interface authorizes a quote. Only quotes with a status of “Pending” can be authorized.

Request Body

Property Type Comments
QuoteID
String ID of the Quote
CreationDate
String

String representing the

date/time (ISO 8601)

that the quote was

created in UTC.

TotalTranslations
Integer

The number of

translations requested.

 For example, if the

merchant sends 5

products to be

translated into 3

languages, the value of

TotalTranslations would

be 15.

TranslationCredit
Integer (optional)

Number of free

translations available

at the selected service

level.

Currency
String

Currency used to pay

for the project. See

glossary for list of

valid currencies.

TotalCost
Decimal

Total price that needs

to be paid. Exclude

translation credit.

PrepaidCredit
Decimal

If a merchant has a

positive credit balance

with onDemand, it will

be reported here.

InternalBillingCode
String

If the site has been set up as a

“provisioning” or “charge back”

site, you have the option to be

invoiced for transactions at a

later date. If the site is

configured as a charge back site,

adding an InternalBillingCode to

the request will automatically

authorize the request and bill

the transaction to a global

purchase order. If the site has

been configured to be a

provisioning site,

InternalBillingCode can be used

optionally with

PurchaseOrderNumber to group

transactions.

PurchaseOrderNumber
String

If the site has been set up as a

“provisioning” site, you have the

option to be invoiced for

transactions at a later date. To

do so, the authorization request

has to contain a

PurchaseOrderNumber that matches

a purchase order we have on file.

AmountDue
Decimal TotalCost - PrepaidCredit
TranslationAcceptanceMethod
String

Tells onDemand how you would

like to track file

acceptance. With the

default method, “implicit,”

we consider a file accepted

when it is downloaded.

With the optional “explicit”

method we do not mark the

file as accepted until we

receive a request to the

Accept Translation API,

see Accept File Translation.

File acceptance/rejection

is only intended to be used

by API clients that do

integrity checks on

deliveries.

These methods are not

intended to be used for

subjective feedback on

translation quality.

Projects

.Project

.ProjectID

Integer ProjectID of included project

Projects

.Project

.ProjectName

String The name of the project

Projects

.Project

.ServiceID

Integer The ID of the service used.

Projects

.Project

.SourceLanguage

.LanguageCode

String

The language code of

source language.

Projects

.Project

.TargetLanguages

.TargetLanguage

.LanguageCode

String

The language code of

a target language.

Projects

.Project

.Products

Container Container of products

Projects

.Project

.Products

.Product

.SKUs

Container

Container of SKU

elements

Projects

.Project

.Products

.Product

.SKUs

.SKU

Container Container of a SKU

Projects

.Project

.Products

.Product

.SKUs

.SKU

.SKUNumber

String Item SKU

Projects

.Project

.Products

.Product

.AssetID

Integer

onDemand internal ID

for the listing

Projects

.Project

.Products

.Product

.DueDate

String

String representing

date/time (ISO 8601

format) that the

translation of the item

is scheduled to be

completed in UTC

Projects

.Project

.Files

.File

.AssetID

Integer Asset ID of the file.

Projects

.Project

.Files

.File

.FileName

String Original name of the file.

Projects

.Project

.ReferenceFiles

.ReferenceFile

Container

Container for a

reference file. A

reference file is used

to inform the work that

is being done. There is

no charge for reference

files.

Projects

.Project

.ReferenceFiles

.ReferenceFile

.AssetID

Integer

Asset ID of the

reference file.

Projects

.Project

.ReferenceFiles

.ReferenceFile

.FileName

String Original name of the file.

Projects

.Project

.ReferenceFiles

.ReferenceFile

.URL

String

URL where the file

can be downloaded.

Projects

.Project

.ReferenceFiles

.ReferenceFile

.TargetLanguages

Container Empty element.

Pay As You Go Request Example

<Quote>
    <QuoteID>795</QuoteID>
    <CreationDate>2014-06-25T16:39:07Z</CreationDate>
    <TotalTranslations>2</TotalTranslations>
    <TranslationCredit>49984</TranslationCredit>
    <TotalCost>0.00</TotalCost>
    <PrepaidCredit>118.99</PrepaidCredit>
    <AmountDue>0.00</AmountDue>
    <Currency>EUR</Currency>
    <TranslationAcceptanceMethod>implicit</TranslationAcceptanceMethod>
    <Projects>
            <Project>
                <ProjectID>999</ProjectID>
                <ProjectName>Name of project</ProjectName>
                <ServiceID>54</ServiceID>
                <SourceLanguage>
                    <LanguageCode>en-gb</LanguageCode>
                </SourceLanguage>
                <TargetLanguages>
                            <TargetLanguage>
                                <LanguageCode>it-it</LanguageCode>
                            </TargetLanguage>
                            <TargetLanguage>
                                <LanguageCode>fr-fr</LanguageCode>
                            </TargetLanguage>
                </TargetLanguages>
                <Products>
                        <Product>
                            <AssetID>999</AssetID>
                            <SKUs>
                                <SKU>
                                    <SKUNumber>123</SKUNumber>
                                </SKU>
                            </SKUs>
                            <DueDate>2014-02-11T10:22:46Z</DueDate>
                        </Product>
                </Products>
                <ReferenceFiles>
                    <ReferenceFile>
                        <AssetID>12345</AssetID>
                        <FileName>my-file.txt</FileName>
                        <URL>https://ondemand.liondemand.com/api/files/12345</URL>
                        <TargetLanguages />
                    </ReferenceFile>
                    <ReferenceFile>
                        <AssetID>12346</AssetID>
                        <FileName>my-file.txt</FileName>
                        <URL>https://ondemand.liondemand.com/api/files/12346</URL>
                        <TargetLanguages />
                    </ReferenceFile>
                </ReferenceFiles>
            </Project>
    </Projects>
</Quote>

Chargeback Request Example

<Quote>
    <QuoteID>795</QuoteID>
    <CreationDate>2014-06-25T16:39:07Z</CreationDate>
    <TotalTranslations>2</TotalTranslations>
    <TranslationCredit>49984</TranslationCredit>
    <TotalCost>0.00</TotalCost>
    <PrepaidCredit>118.99</PrepaidCredit>
    <AmountDue>0.00</AmountDue>
    <Currency>EUR</Currency>
    <InternalBillingCode>ABCD100001</InternalBillingCode>
    <TranslationAcceptanceMethod>implicit</TranslationAcceptanceMethod>
    <Projects>
            <Project>
                <ProjectID>999</ProjectID>
                <ProjectName>Name of project</ProjectName>
                <ServiceID>54</ServiceID>
                <SourceLanguage>
                    <LanguageCode>en-gb</LanguageCode>
                </SourceLanguage>
                <TargetLanguages>
                            <TargetLanguage>
                                <LanguageCode>it-it</LanguageCode>
                            </TargetLanguage>
                            <TargetLanguage>
                                <LanguageCode>fr-fr</LanguageCode>
                            </TargetLanguage>
                </TargetLanguages>
                <Products>
                        <Product>
                            <AssetID>999</AssetID>
                            <SKUs>
                                <SKU>
                                    <SKUNumber>123</SKUNumber>
                                </SKU>
                            </SKUs>
                            <DueDate>2014-02-11T10:22:46Z</DueDate>
                        </Product>
                </Products>
                <ReferenceFiles>
                    <ReferenceFile>
                        <AssetID>12345</AssetID>
                        <FileName>my-file.txt</FileName>
                        <URL>https://ondemand.liondemand.com/api/files/12345</URL>
                        <TargetLanguages />
                    </ReferenceFile>
                    <ReferenceFile>
                        <AssetID>12346</AssetID>
                        <FileName>my-file.txt</FileName>
                        <URL>https://ondemand.liondemand.com/api/files/12346</URL>
                        <TargetLanguages />
                    </ReferenceFile>
                </ReferenceFiles>
            </Project>
    </Projects>
</Quote>

Provisioning Request Example

<Quote>
    <QuoteID>795</QuoteID>
    <CreationDate>2014-06-25T16:39:07Z</CreationDate>
    <TotalTranslations>2</TotalTranslations>
    <TranslationCredit>49984</TranslationCredit>
    <TotalCost>0.00</TotalCost>
    <PrepaidCredit>118.99</PrepaidCredit>
    <AmountDue>0.00</AmountDue>
    <Currency>EUR</Currency>
    <PurchaseOrderNumber>123456</PurchaseOrderNumber>
    <InternalBillingCode>ABCD100001</InternalBillingCode>
    <TranslationAcceptanceMethod>implicit</TranslationAcceptanceMethod>
    <Projects>
            <Project>
                <ProjectID>999</ProjectID>
                <ProjectName>Name of project</ProjectName>
                <ServiceID>54</ServiceID>
                <SourceLanguage>
                    <LanguageCode>en-gb</LanguageCode>
                </SourceLanguage>
                <TargetLanguages>
                            <TargetLanguage>
                                <LanguageCode>it-it</LanguageCode>
                            </TargetLanguage>
                            <TargetLanguage>
                                <LanguageCode>fr-fr</LanguageCode>
                            </TargetLanguage>
                </TargetLanguages>
                <Products>
                        <Product>
                            <AssetID>999</AssetID>
                            <SKUs>
                                <SKU>
                                    <SKUNumber>123</SKUNumber>
                                </SKU>
                            </SKUs>
                            <DueDate>2014-02-11T10:22:46Z</DueDate>
                        </Product>
                </Products>
                <ReferenceFiles>
                    <ReferenceFile>
                        <AssetID>12345</AssetID>
                        <FileName>my-file.txt</FileName>
                        <URL>https://ondemand.liondemand.com/api/files/12345</URL>
                        <TargetLanguages />
                    </ReferenceFile>
                    <ReferenceFile>
                        <AssetID>12346</AssetID>
                        <FileName>my-file.txt</FileName>
                        <URL>https://ondemand.liondemand.com/api/files/12346</URL>
                        <TargetLanguages />
                    </ReferenceFile>
                </ReferenceFiles>
            </Project>
    </Projects>
</Quote>

Return Codes

Status Code Comments
Accepted 202

The approval was

accepted.

Bad Request 400

This could be that the

project doesn’t e

Unauthorized 401

The request did not

pass authentication or

the customer is not a

member of an enterprise

site.

Payment Required 402

The customer must pay

for the project before

authorizing it.

Not Found 404

The URL does not relate

to a project that the

merchant owns.

Method not Allowed 405

The Quote is not ready

to be paid because the

price is not set.

Conflict 409

The quote is no longer

valid.  The response

body will return a

corrected quote that

can be approved.

Response Body

Parameter Type Comment
Status
String

Status of the quote.

 Authorized means that

the projects have been

paid for and the

project can start.

 Pending means that the

merchant must execute a

transaction to pay for

the project.  Look for

a PaymentURL for the

merchant to click

through.

PaymentURL
String

If additional funds are

required, the status

code of 402 will be

returned and the

response will include a

PaymentURL that

includes a link to a

paypal page.

QuoteURL
String

URL that can be used to

check the status of the

quote.  This is useful

for polling quotes that

are externally paid

for.  See Get Quote.

TranslationAcceptanceMethod
String

Method to track file

acceptance. Defaults to

“implicit” if not

supplied during

generate quote.

Projects
Container

A list of projects that

have been generated by

this transaction.

Projects

.Project

.ProjectID

Integer

onDemand Project ID for

the project.

Projects

.Project

.ProjectURL

String

A URL that can be

checked for the status

of the project.

Projects

.Project

.ProjectDueDate

String

String representing the

date/time (ISO 8601)

that the project will

be completed by.

Projects

.Project

.Products

Container

List of products

included in the

product.

Projects

.Project

.Products

.Product

.SKUNumber

String

Client supplied SKU

Number

Projects

.Project

.Products

.Product

.AssetID

Integer

Internal onDemand ID

for this product.

Product-Based Quote Authorization Response Example

No Payment Required

<QuoteAuthorization>
    <Status>Authorized</Status>
    <QuoteURL>https://</QuoteURL>
    <TranslationAcceptanceMethod>implicit</TranslationAcceptanceMethod>
    <Projects>
        <Project>
            <ProjectID>123</ProjectID>
            <ProjectURL>https://</ProjectURL>
            <ProjectDueDate>2014-02-11T10:22:46Z</ProjectDueDate>
            <Products>
                <Product>
                    <AssetID>999</AssetID>
                    <SKUs>
                        <SKU>
                            <SKUNumber>123</SKUNumber>
                        </SKU>
                    </SKUs>
                </Product>
            </Products>
        </Project>
    </Projects>
</QuoteAuthorization>

Payment Required

<QuoteAuthorization>
    <Status>Pending</Status>
    <PaymentURL>https://</PaymentURL>
    <QuoteURL>https://</QuoteURL>
    <TranslationAcceptanceMethod>implicit</TranslationAcceptanceMethod>
    <Projects>
        <Project>
            <ProjectID>123</ProjectID>
            <ProjectURL>https://</ProjectURL>
            <ProjectDueDate>2014-02-11T10:22:46Z</ProjectDueDate>
            <Products>
                <Product>
                <AssetID>999</AssetID>
                <SKUs>
                    <SKU>
                        <SKUNumber>123</SKUNumber>
                    </SKU>
                </SKUs>
                </Product>
            </Products>
        </Project>
    </Projects>
</QuoteAuthorization>

File-Based Quote Authorization Response Example

No Payment Required

<QuoteAuthorization>
    <Status>Authorized</Status>
    <QuoteURL>https://</QuoteURL>
    <TranslationAcceptanceMethod>implicit</TranslationAcceptanceMethod>
    <Projects>
        <Project>
            <ProjectID>123</ProjectID>
            <ProjectURL>https://</ProjectURL>
            <ProjectDueDate>2014-02-11T10:22:46Z</ProjectDueDate>
            <Files>
                <File>
                    <Status>Analyzed</Status>
                    <AssetID>123</AssetID>
                    <FileName>example.txt</FileName>
                </File>
            </Files>
        </Project>
    </Projects>
</QuoteAuthorization>

Payment Required

<QuoteAuthorization>
    <Status>Pending</Status>
    <PaymentURL>https://</PaymentURL>
    <QuoteURL>https://</QuoteURL>
    <TranslationAcceptanceMethod>implicit</TranslationAcceptanceMethod>
    <Projects>
        <Project>
            <ProjectID>123</ProjectID>
            <ProjectURL>https://</ProjectURL>
            <ProjectDueDate>2014-02-11T10:22:46Z</ProjectDueDate>
            <Files>
                <File>
                    <Status>Analyzed</Status>
                    <AssetID>123</AssetID>
                    <FileName>example.txt</FileName>
                </File>
            </Files>
        </Project>
    </Projects>
</QuoteAuthorization>

Parsing Failed

If one or more of the files submitted for this quote did not parse properly

<QuoteAuthorization>
    <Status>Error</Status>
    <QuoteURL>https://</QuoteURL>
    <TranslationAcceptanceMethod>implicit</TranslationAcceptanceMethod>
    <Projects>
        <Project>
            <ProjectID>123</ProjectID>
            <ProjectURL>https://</ProjectURL>
            <ProjectDueDate>2014-02-11T10:22:46Z</ProjectDueDate>
            <Files>
                <File>
                    <Status>Analyzed</Status>
                    <AssetID>123</AssetID>
                    <FileName>example.txt</FileName>
                </File>
                <File>
                    <Status>Analysis Failed</Status>
                    <AssetID>124</AssetID>
                    <FileName>example2.txt</FileName>
                </File>
            </Files>
        </Project>
    </Projects>
    <Error>
        <ReasonCode>307</ReasonCode>
        <SimpleMessage>Parsing Failed</SimpleMessage>
        <DetailedMessage>
                        One or more of the files
                        encountered a parsing
                        error. This quote is
                        invalid.
        </DetailedMessage>
    </Error>
</QuoteAuthorization>

Errors

If Authorize Quote encountered an error, the response will contain an Error element consisting of a ReasonCode, SimpleMessage, and DetailedMessage elements. See Error Handling and Rate Throttling for more information. The most common error will be related to a conflict (HTTP status code 409), which happens when the quote information submitted does not match the information within the onDemand service.

ReasonCode SimpleMessage DetailedMessage
300 Miscellaneous error

A miscellaneous or

unexpected error

has occured.

301

The number of available

translation credits has

changed.

When this quote was

created, the number of

available translation

credit was different

than are available now.

302

The amount of prepaid

available pre-paid

has changed.

When this quote was

created, the amount of

prepaid credit was

different than it is

now.

303 Wrong quote ID

The QuoteID in the

request body does not

match what was in the

URL.

304 Wrong language options

The source or target

languages are different

that when the quote

was created.

305 Price change

The price has changed.

This could be because

less credit is available

or it could be because

the information sent

in the quote has been

been altered.

306 Quote Not Ready

The quote is not yet in

a pending state so

it cannot be authorized.

This reason code will

be accompanied by an

HTTP status code of 405.

307 Parsing Failed

One or more of the files

encountered a parsing

error. This quote is

invalid.

308 Invalid Purchase Order

The purchase order

number submitted is

either invalid or the

purchase order has an

insufficient remaining

balance.

309

Buyer not authorized

for purchase orders.

This buyer is not

authorized to use

purchase orders.

310

Improperly configured

site billing information

The billing information

on this site is not

properly configured.