To assign the total cost of the Order to one or more payment groups, use the addOrderAmountToPaymentGroup() and addRemainingOrderAmountToPaymentGroup() methods in the OrderManager. These methods add PaymentGroupOrderRelationship objects (of type OrderAmount or OrderAmountRemaining, respectively) to the Order.

Example 1

This example assigns an order’s total cost to a single PaymentGroup. The order’s total cost is $20.90. You can account for the total cost of the Order by calling:

The disadvantage to calling addOrderAmountToPaymentGroup() instead of addRemainingOrderAmountToPaymentGroup() is that if the order’s total amount increases above $20.90, then you must call removeOrderAmountFromPaymentGroup() and then call addOrderAmountToPaymentGroup() again and pass in the new amount.

Example 2

This example assigns an order’s total cost to more than one PaymentGroup. The order’s total cost is $20.90, and there are two payment groups in the Order. You want to assign $10.00 to the first PaymentGroup and $10.90 to the second PaymentGroup. Follow these steps to assign the amounts to the different payment groups:

Accounting for an Order’s Total Cost

If the total cost of an Order is assigned to one or more payment groups, then during checkout the order’s total cost is accounted for according to the following rules:

 
loading table of contents...