Ambiguous API Response for Invoice_Create

Firstly, thanks for the excellent product and any assistance that can be offered.

I am using the API to integrate into my product but have came across an error that I can’t seem to get around.

I have created an item and want to create a recurring monthly invoice for it. I am sending the following data and getting the followin response (format is a printed PHP array)

Array
(
    [InvoiceData] => Array
        (
            [InvoiceType] => RECURRING
            [ClientID] => 898808
            [ClientAddress] => Array
                (
                    [Address] => 
                    [CountryISO] => GB
                )

            [Currency] => GBP
            [TermDays] => 7
            [Language] => en
            [RecurringInvoiceData] => Array
                (
                    [Interval] => 1MONTH
                    [Frequency] => 60
                    [StartDate] => 2014-09-22
                    [SendByEmail] => 1
                    [SendByPost] => 0
                    [ActivateOnCreation] => 1
                )

            [InvoiceLines] => Array
                (
                    [ItemLines] => Array
                        (
                            [ItemLine] => Array
                                (
                                    [ItemID] => 0
                                    [ItemName] => One domain a month
                                    [ItemDescription] => Choose 1 domain a month, pay monthly
                                    [UnitCost] => 1
                                    [Qty] => 1
                                )

                        )

                )

        )

)
Array
(
    [Header] => Array
        (
            [MessageType] => Response
            [SubmissionNumber] => 1411368558899
        )

    [Body] => Array
        (
            [Errors] => **Object reference not set to an instance of an object.**
        )

)

I can’t find any pertinent references to this error so I’m unsure whether it’s a bug or an issue with the data I’m sending.

I do have “Recurring purchases” checked in my Quickfile account if that makes any difference.

Best Regards

Just to check, you are sending this as XML to Quickfile?

Do you have a copy of the XML you are sending at all please?

Are you able to take the XML and paste it into the Sandbox area? Do you get the same response there?

You can access your sandbox from the My Apps section in QuickFile.

EDIT:

I have replicated this error and we’re looking into this now.

UPDATE:

We’ve issued a fix that should get rolled out this afternoon. If you want to bypass the error in the mean time you should be able to do so by supplying a Purchase Reference. The error is due to the recurring invoice API always expecting a purchase ref.

2 Likes

Thank you for looking into it.

I kind of assumed it was out of my control as I tried 100 variations of the data and studied the schema closely. I tried using a purchasereference but it doesn’t seem to fit anywhere other than in the SingleInvoiceData type. Putting it in there complains that the RecurringInvoiceData no longer belongs in the request. I get the same response in the sandbox, looking forward to the patch this afternoon.

<Invoice_Create xmlns="http://www.QuickFile.co.uk" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.QuickFile.co.uk http://www.quickfile.co.uk/WebServices/API/Schemas/invoices/Invoice_Create.xsd">
<Header>
    <MessageType>Request</MessageType>
    <SubmissionNumber>14113933880805</SubmissionNumber>
    <Authentication>
    <AccNumber>xxxx</AccNumber>
    <MD5Value>xxxx</MD5Value>
    <ApplicationID>xxxx</ApplicationID>
    </Authentication>
</Header>
<Body>
    <InvoiceData>
        <InvoiceType>RECURRING</InvoiceType>
        <ClientID>898808</ClientID>
        <ClientAddress>
        <Address>-</Address>
        <CountryISO>GB</CountryISO>
        </ClientAddress>
        <Currency>GBP</Currency>
        <TermDays>7</TermDays>
        <Language>en</Language>
        <RecurringInvoiceData>
        <Interval>1MONTH</Interval>
        <Frequency>60</Frequency>
        <StartDate>2014-09-22</StartDate>
        <SendByEmail>1</SendByEmail>
        <SendByPost>0</SendByPost>
        <ActivateOnCreation>1</ActivateOnCreation>
        </RecurringInvoiceData>
        <InvoiceLines>
        <ItemLines>
        <ItemLine>
        <ItemID>161039</ItemID>
        <UnitCost>0.00</UnitCost>
        <Qty>1</Qty>
        </ItemLine>
        </ItemLines>
        </InvoiceLines>
    </InvoiceData>
</Body>
</Invoice_Create>

I believe this has now been resolved, please would you kindly retry your code.

My request went through fine, I believe it is working now.

Thank you for addressing the problem, much appreciated.

1 Like

This topic was automatically closed after 9 hours. New replies are no longer allowed.