[New 4.1.14] Limiting Payments by Payment Type

###Why we need such feature
In some cases you may need to limit payment types by products. For example if you sell some stuff other than food you may want to allow Sodexo payments only for food sales. In this tutorial I’ll show you how to implement this case. We’ll start from default installation so I’ll also show how to configure custom payment buttons. Also I’ll allow Sodexo only for Beverages. At the end I’ll be able to receive payments with Sodexo only for permitted products.

Note: This tutorial also intended to demonstrate custom product tagging. If your non-food products grouped under specific product groups you can use product group value instead of product tags.

###Configuring Sodexo Payment Button

To configure a new payment type we have to start by creating an account.

We’ll track whole Sodexo payment history under this account. Account type should be Payment Accounts. This is a pre-configured account type.

Since we already have Account Transaction type for Payments we also don’t need to create an account transaction type.

On next step we’ll create a Payment Type for Sodexo Payments. Navigate to Tickets > Payment Types screen and create a new payment type.

That configuration creates a button on Payment screen. I need to map this button to Sodexo account so I can correctly track Sodexo payments.

Now I need to map this button on Mappings tab.

If I have multiple ticket types I can map this button to a specific ticket type.

After saving it create a ticket to check if Sodexo button appears correctly or not.

I can change ordering of these buttons by changing sort order of Payment Types.

Limiting Payments

In this tutorial I’m assuming I’ll accept Sodexo payment only for beverages. To be able to do this I’ll create a custom tag for products and tag Beverages as SDX (Sodexo)

As 4.1.14 Payment types accepts filtering by Order State. When I configure a filter for a payment type I can only pay orders. I’ll change Sodexo Payment Type to make it available for only orders that have SDX State.

That means I’ll be able to use Sodexo payments for orders that’s PF state equals to SDX. Now I need to mark products that can be paid with Sodexo and update related orders.

First of all I’ll configure a custom product tag.

… and I’ll tag all beverages as SDX

That means we’ll tag all products that we’ll permit Sodexo payment as SDX

Note: I’m using an abbreviation of Sodexo here so it consumes less database storage.

After tagging all products that can be paid with Sodexo, I’ll create an action to mark orders that can be paid with Sodexo card.

This action will update Order’s PF (Payment Filter) state so I can understand which orders can be paid with Sodexo.

Now I’ll create a rule to execute this action when I add an order to ticket.

When an Order added to ticket order’s payment filter updates with product’s Payment tag.

Finally we need to create mapping for this rule.

Now let’s see how it works.

###Demo

Beverage orders should be appear with SDX state since I’ve allowed Sodexo payments for them. Normally non-admin users won’t see these state values so be sure you are testing it with an admin user.

Total amount of beverages is 3.25 so I can receive at most 3.25 sodexo payment. Let’s see how it appears on payment screen.

Sodexo button displays maximum available payment value. I can’t settle more than 3.25 with Sodexo.