You could take a look at this
Taking cashback from a card is pretty much similar to what you suggest. You pay with card and cash is given back as part of the transaction.
However, I would be cautious about doing what you suggest, you may be breaking your merchant agreement as in many places giving cash from a credit card would be considered as a cash advance (usually charged with higher interest by the card company + additional fees), and you usually need special provisions on your agreement in place to give “cashback”. For example, in the UK, cashback is only available from some retailers who have approval from their bank, and it is for debit cards only (not credit cards).