I assume you’re talking about pre-pay calling credit here?
So do that, then!
Note that this is specific to the particular operator - some operators don’t provide this service, and others may use different code
(Vodafone UK uses “*#1345#”)
Note that this is actually an Unstructured Supplementary Service - so you can also send AT+cusd=1,“*#1345#”