Add payment with barcode


My restaurant accepts “vouchers”, that are given out by the state, to pay for meals.
Each voucher has a unique barcode, that contains the amount.
The barcode is formated like this : XXXXXXXXXXXMMMMMXXXX
With the MMMMM is the amount.

Example :
05285081280 00771 25100000 is a voucher for 7,71€
06015674775 00500 15700000 is a voucher for 5,00€

Is there a way to extract the numbers between the 12th and 16th position of the barcode, and to apply is as a payment method ?

So when an employee scans the barcode, it is automaticaly applied as payed for that amout ?

Thanks for your help ! :grinning:

Either with helper or script.
Think it would be slice() for helper would need to check or as I say in script.
Either way definatly posible.

How do you validate them?