Your on board account is set up via your online check in.
There is a section that will ask which payment method you will be using for your on board account.
You have the option of either cash or credit card.
With the cash option you will need to provide them with cash and any on board purchases will be automatically deducted from your cash account.
Most cruise lines have a minimum amount required to set up a cash account (this varies between cruise lines).
The cruise ship will let you know when you are low on funds and you will be required to top up your onboard account.
If you choose to use the credit option for your on board purchases your credit card will be charged the night before disembarkation and an itemised account statement will be delivered to your stateroom