XML Postback
UltraCart Webhooks supercede the XML Postback. They are superior in every way.
Please see the API page for help using webhooks.
- 1 XML Postback
- 1.1 Introduction
- 1.1.1 Key Benefits
- 1.2 Prerequisites
- 1.3 XML Postback Script
- 1.4 Configuring XML Postback
- 1.4.1 Option 1: Transmit to URL when order placed
- 1.4.2 Option 2: Transmit to URL when stage changes
- 1.4.3 Option 3: Transmit Auto Order Status to URL
- 1.4.4 Refund Postbacks
- 1.4.5 Save Changes
- 1.4.5.1 Auto Order Update XML details
- 1.4.6 Advanced Configuration
- 1.4.7 Multiple URLs
- 1.4.8 Logs
- 1.4.9 Error Handling
- 1.5 Handling Read Timeouts
- 1.6 Restarting Postbacks After Errors Have Halted Postback Processing
- 1.7 How do I resend historical data to my server via XML postback?
- 1.8 Refunds
- 1.9 Frequently Asked Questions (FAQ)
- 1.10 Conclusion
- 1.11 Next Steps
- 1.1 Introduction
XML Postback
Introduction
UltraCart’s XML Postback feature allows merchants to automatically receive an XML copy of an order shortly after it is placed. This process enables merchants to perform custom server-side operations such as validation, logging, or integration with external systems.
Although still available, UltraCart recommends using Webhooks instead, as they provide more robust functionality and greater flexibility.
Key Benefits
Automatically receive orders in XML format after they are placed.
Perform server-side validation or custom business logic.
Optionally receive updated order status changes.
Receive updates for Auto Orders when they change.
Prerequisites
Prerequisite: This feature is intended for advanced merchants or developers with programming experience.
To use XML Postback, you must:
Have a web server that supports HTTPS.
Create a script capable of:
Receiving one order per postback (in XML format).
Performing your desired functions.
Returning an HTTP 200 OK response to UltraCart.
XML Postback Script
UltraCart will post an XML message to your configured URL. This message is equivalent to manually exporting one order in the W3C Schema XML format from Order Management → Export Orders.
Popular languages for handling XML Postbacks include PHP, Python, Perl, Java, Ruby, and C#.
Example script: xmlPostBackExample.php
XML Schema reference: ultracart.xsd
Tip: Your script should immediately acknowledge receipt of the XML (return
200 OK) and offload heavy processing to a queue (database, Redis, SQS, etc.). This prevents timeouts and allows UltraCart to deliver high-volume postbacks efficiently.
Programmers need to be aware that the XML is within the HTTP body, not in parameters.
Configuring XML Postback
Log in to your UltraCart account.
Navigate to:
Main Menu → Configuration → Development → XML Post BackChoose one or more configuration options:
Option 1: Transmit to URL when order placed
UltraCart posts the order once it is created.
Postbacks repeat until your server responds with 200 OK.
Option 2: Transmit to URL when stage changes
UltraCart posts whenever the current_stage field changes.
Stages include:
IN(Inserting)AR(Accounts Receivable)PC(Pending Clearance) ← Checks orders and Amazon PaymentsSD(Shipping Department)CO(Completed Order)PO(Preorder)QR(Quote Request)QS(Quote Sent)REJ(Rejected)…and more
Option 3: Transmit Auto Order Status to URL
UltraCart posts updates when an auto order changes.
Example fields:
auto_order_codeoriginal_order_idstatus(active, cancelled, declined, terminated)next_attempt,failure_reason
Refund Postbacks
If you use the second option "Transmit to URL when stage changes" then UltraCart will also send you an XML postback when a refund occurs. When refunds occur the order can be in multiple stages (SD or CO typically) so you will want to look for the following elements in the XML:
subtotal_discount_refundedsubtotal_refundedother_refundedtax_refundedshipping_handling_refundedbuysafe_refundedtotal_refundedrefund_dts
If a refund has occurred, the elements "total_refunded" and "refund_dts" will always exist. The other elements mentioned above will exist if that component of the order was refunded.
UltraCart will not send duplicate notifications. If you configure the second option (stage changes), you will not receive any notifications via the first option. Instead, when an order is placed, you'll receive a postback with the appropriate stage change (depends on the status/success of the order).
Save Changes
Once you've entered the URL into the appropriate field, click on the "Save" button at the bottom of the screen. Your configuration is complete.
Auto Order Update XML details
auto_order
original_order_id
auto_order_code
firstname
lastname
email
address
address2
city
state
zip
company
country
home_phone
cell_phone
office_phone
custom_field_1
custom_field_2
custom_field_3
custom_field_4
custom_field_5
custom_field_6
custom_field_7
status = active, card declined, cancelled upgrade, cancelled downgrade, cancelled, terminated
next_attempt
attempt
failure_reason
status
cancelled_by
cancelled_dts
original_items
item
item_id
description
unit_cost
quantity
auto_order_items
auto_order_item
original_item_id
quantity
frequency_override
next_shipment
next_item_id
no_orders_after
override_unit_cost
override_unit_cost_next_x_orders
percentage_discount
next_preshipment_notice
Advanced Configuration
Multiple URLs
Enter multiple URLs separated by a space.
UltraCart retries all configured URLs until each returns 200 OK.
Warning: We recommend no more than 2–3 URLs. All must succeed, or the postback is retried.
Logs
Use the Log button in the XML Postback configuration screen to review:
Order ID
Timestamp
Server response
When you click on the log it will show you the order id, timestamp, and result for each transmission. Notice that we can quickly see that UltraCart
is having trouble connecting to this server.
For each transmission you can see what is sent to your server and what is returned as shown below.
Notice that UltraCart is logging the response back from your server.
It only cares about the 200 result code to determine success,
but logging the response from your server allows you to output information that you can review in the logs for debugging purposes.
Error Handling
UltraCart disables postbacks after 50 consecutive errors.
Queued postbacks resume once you re-save the XML Postback configuration.
Common HTTP errors:
Code | Meaning |
|---|---|
200 | OK |
301 | Moved Permanently |
302 | Redirect |
400 | Bad Request |
401 | Unauthorized |
403 | Forbidden |
404 | Script not found |
405 | Method Not Allowed |
500 | Internal Server Error |
The complete list can be found at HTTP/1.1: Status Code Definitions
Handling Read Timeouts
UltraCart allows up to 60 seconds for your server to respond.
Always queue the XML immediately; never run long processes in the postback handler.
Do not try and perform complex processing of the XML postback document on your receiver. Simply queue up the XML document in a persistent storage (database, Redis, SQS, etc.) and then perform your more complex processing in a decoupled fashion. This will allow you to receive a greater velocity of XML postbacks from UltraCart and fan out the processing of those postbacks appropriately.
Restarting Postbacks After Errors Have Halted Postback Processing
If UltraCart encounters 50 consecutive errors from your server, it will disable the XML postback and email you. The transmissions will queue up until you edit your XML Postback configuration.
After reviewing the logs to determine the cause of the errors. To restart the processing of the queued orders, re-save the XML PostBack settings (Click the save button on the XML Postback configuration page.)
How do I resend historical data to my server via XML postback?
Identify the first and last order id for the range of data that you want to resend to your new XML postback URL. Use the batch order operation utility to populate the XML postback queue.
Refunds
Orders with partial refunds will report the item Id's of the refunded items, whereas complete refunds will not include the item Id's by default.
Please Note
If you need the complete refunds to report the item ID's in the order, contact UltraCart by emailing support@ultracart.com stating your UltraCart MerchantID requesting that we enable the merchant property "XML Postback - Skip Adjustment for Refund".
With this property is enabled, it will prevent refunded items from being removed from the XML postback, so you will see these items in your refund transaction XML packet.
Pay close attention to these optional elements that will indicate the refunding of the item:
quantity_refunded
total_refunded
Frequently Asked Questions (FAQ)
Conclusion
The XML Postback feature enables merchants to build custom integrations by receiving orders and updates directly to their server. However, UltraCart strongly recommends migrating to Webhooks, which provide a more modern and flexible solution.
Next Steps
Learn more about UltraCart Webhooks
Review the XML Schema
Contact UltraCart Support for advanced configurations