How to properly charge credit cards?

You need to be careful with credit card data (and there are often fairly strict requirements about how it's kept and so on).
It's far easier to isolate the part that deals with the sensitive data and lock that down than to do the same thing to your whole app.

You want the part handling cards to have the smallest vulnerability profile possible and a good way to do that is to separate it completely from your application. While a mistake that made your app leak data or allowed unauthorised access would be bad, it would be even worse if you leaked credit card data.