Вопрос

When I use the IPP Rest API 3.0 to create a invoice, a example like this:

<Invoice xmlns="http://schema.intuit.com/finance/v3">
       <Line>
            <Description>Installation labor</Description>
            <Amount>420.00</Amount>
            <DetailType>SalesItemLineDetail</DetailType>
            <SalesItemLineDetail>
                <ItemRef>33</ItemRef>
            </SalesItemLineDetail>
        </Line>
      <CustomerRef>20</CustomerRef>
</Invoice>

In this example, 20 is the Id of this customer.

Now, for a third party program, it might not know the Id of this customer, might know the Name of the customer, so , I understand I can always query the customer to get the Id back first, then use that Id in this invoice creating format.

But my question is, can I just use the name without specify the Id of this customer to create this invoice?

Will the following works?

<Invoice xmlns="http://schema.intuit.com/finance/v3">
       <Line>
            <Description>Installation labor</Description>
            <Amount>420.00</Amount>
            <DetailType>SalesItemLineDetail</DetailType>
            <SalesItemLineDetail>
                <ItemRef>33</ItemRef>
            </SalesItemLineDetail>
        </Line>
      <CustomerRef name="ACB Company"></CustomerRef>
</Invoice>

Further more, If it DOES work, does this logic apply to all the ReferenceType in the API?

Это было полезно?

Решение

No. In API payload, you can't refer objects by name ( this behavior was partially supported in old V2 API which is now deprecated ).

You can verify this behavior using Apiexplorer.

In this case, you should query the customer by name and then extract the ID to refer it in the invoice create payload.

Thanks

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top