Order Service

OrderService is used to build, create and charge for an order.


OrderService.placeOrder

Returns the result of order placement. The ids of the order and invoice that were created are returned along with the status of a credit card charge if one was made.

Required Parameters

Parameter Name Type Definition
key String Your Infusionsoft API key
contactId int The id of the contact to place on the order
creditCardId int The id of the credit card to charge, leave it at zero to indicate no credit card.
payPlanId int The id of the payment plan to use in building the order. If no pay plan is specified then the default payment plan is used.
productIds List<Integer> The list of products to purchase on the order, this cannot be empty if no subscription plans are specified.
subscriptionPlanIds List<Integer> The list of subscriptions to purchase on the order, this cannot be empty if no products are specified.
processSpecials boolean Whether or not the order should consider discounts that would normally be applied if this order was being placed through the shopping cart.
promoCodes List<String> Any promo codes to add to the cart, only used if processing of specials is turned on.
leadAffiliateId int Optional int ID of the lead affiliate
saleAffiliateId int Optional int ID of the sale affiliate

Sample Request

<?xml version='1.0' encoding='UTF-8'?>
<methodCall>
  <methodName>OrderService.placeOrder</methodName>
  <params>
    <param>
      <value><string>privateKey</string></value>
    </param>
    <param>
      <value><int>contactId</int></value>
    </param>
    <param>
      <value><int>creditCardId</int></value>
    </param>
    <param>
      <value><int>payPlanId</int></value>
    </param>
    <param>
      <value><int>productIds</int></value>
    </param>
    <param>
      <value><int>subscriptionPlanIds</int></value>
    </param>
    <param>
      <value><boolean>processSpecials</boolean></value>
    </param>
    <param>
      <value><int>promoCodes</int></value>
    </param>
  </params>
</methodCall>

Sample Response

<?xml version='1.0' encoding='UTF-8'?>
<methodResponse>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>
              Successful
            </name>
            <value>
              false
            </value>
          </member>
          <member>
            <name>
              Message
            </name>
            <value>
              None
            </value>
          </member>
          <member>
            <name>
              RefNum
            </name>
            <value>
              None
            </value>
          </member>
          <member>
            <name>
              OrderId
            </name>
            <value>
              74
            </value>
          </member>
          <member>
            <name>
              InvoiceId
            </name>
            <value>
              74
            </value>
          </member>
          <member>
            <name>
              Code
            </name>
            <value/>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodResponse>

PHP iSDK Sample

$carray = array(
	php_xmlrpc_encode($app->key),
	php_xmlrpc_encode($contactId),  
	php_xmlrpc_encode($creditCardId), 
	php_xmlrpc_encode($payPlanId), 
	php_xmlrpc_encode(array($productId1, $productId2)), 
	php_xmlrpc_encode(array($subscriptionPlanId1, $subscriptionPlanId2)), 
	php_xmlrpc_encode($processSpecials), 
	php_xmlrpc_encode(array($promoCode1, $promoCode2)) // array of strings
);
$app->methodCaller("OrderService.placeOrder", $carray);