Payment Director - checking the selected shipping method

In Payment Director, you can check which shipping method/option was selected by the customer and use it to conditionally show a payment method.  For example, you might have

Option

Payments.CashOnDelivery

ShippingOption != null and ShippingOption.ShippingRateComputationMethodSystemName = "Shipping.ByWeightByTotal"

Note that that we prefix the expression with ShippingOption != null  (or you can write  ShippingOption <> null).  This is good practice, because if you have (or ever plan to get) a "button payment method" (that appears in the cart as a button under the chekout button), then Payment Director may get called "prematurely" with respect to not having the selected shipping method.  Having the null check will prevent erros being logged.

(See this blog for additional information: Payment Director and PayPal Express)

Comments
Leave your comment
: