Adding a manual payment via XML-RPC

Hello. I’m attempting to add a manual payment to an invoice, and it’s not working. All I get back is a 0 with no explanation or error of why the payment has not been added. Turning on the return header in cURL is of no help, there’s nothing there, either. Here is a sample request:

<methodCall>
  <methodName>InvoiceService.addManualPayment</methodName>
  <params>
    <param>
      <value><string>{$key}</string></value>
    </param>
    <param>
      <value><int>{$invoiceId}</int></value>
    </param>
    <param>
      <value><double>{$oTotal}</double></value>
    </param>
    <param>
      <value><dateTime.iso8601>{$kDate}</dateTime.iso8601></value>
    </param>
    <param>
      <value><string>Credit</string></value>
    </param>
    <param>
      <value><string>Paid via Amazon.com</string></value>
    </param>
    <param>
      <value><boolean>1</boolean></value>
    </param>
  </params>
</methodCall>

Thank you!

Two things, I presume you have this part at the top.

<?xml version='1.0' encoding='UTF-8'?>

And that the “$kDate” is formatted to this Date Format “Ymd\TH:i:s”

PHP Example: $date->format('Ymd\TH:i:s')

Yep! I’ve made significant progress, and this is the last step in my first integration.

I forgot to mention that when dealing with Dates you need to specify the Timezone to United States - Eastern Time Zone.

PHP Time Zone Example: America/New_York

I’m at a loss for what to do to get this working. Here is an example request. All i get back is a 0 with no explanation why.

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
  <methodName>InvoiceService.addManualPayment</methodName>
  <params>
    <param>
      <value><string>ourkey</string></value>
    </param>
    <param>
      <value><int>320</int></value>
    </param>
    <param>
      <value><double>84.54</double></value>
    </param>
    <param>
      <value><dateTime.iso8601>20230906T13:42:06</dateTime.iso8601></value>
    </param>
    <param>
      <value><string>Credit Card (Manual)</string></value>
    </param>
    <param>
      <value><string>Paid via Amazon.com</string></value>
    </param>
    <param>
      <value><boolean>0</boolean></value>
    </param>
  </params>
</methodCall>

I took a look at what the iSDK generated for the Payment.

Have you checked the Order to see if the Payment is present?

<?xml version="1.0"?>
<methodCall>
    <methodName>InvoiceService.addManualPayment</methodName>
        <params>
            <param>
                <value><string>----API_KEY----</string></value>
            </param>
            <param>
                <value><int>936</int></value>
            </param>
            <param>
                <value><double>0.56</double></value>
            </param>
            <param>
                <value><dateTime.iso8601>20230907T15:42:01</dateTime.iso8601></value>
            </param>
            <param>
                <value><string>Credit Card</string></value>
            </param>
            <param>
                <value><string>Order Form</string></value>
            </param>
            <param>
                <value><boolean>0</boolean></value>
            </param>
        </params>
</methodCall>

It’s still not working. I have tried so many combinations of strings and numbers and blah blah blah. I submitted a ticket to support. Maybe they can help.

The only things that come to mind is the following.

  • Have you set the Invoice Id for the Payment correctly? Invoice Ids may not always align withe Order Ids, so if you are using the wrong Id then the Payment may or may not be added correctly.

  • Are you passing special characters in the data?

  • Try putting Double Quotes for the XML part: <?xml version="1.0" encoding="UTF-8"?>

If all is okay, then you need to see what Support say about it.

Thank you, Pav.

Yep, the invoice ID is correct because I use InvoiceService.createBlankOrder, get the ID from that, add items to the invoice with InvoiceService.addOrderItem using the same ID. Is it the same ID to add a payment?

There are no special characters.

All of my other calls have single quotes in the XML part. Could that really make a difference?