It depends on your application's payment provider.
Some providers have a set of designated test credit card numbers that you can use against their production gateway. These will process as though they are normal credit cards but no actual payments will be made.
Others have a test gateway that you can connect to and run all your tests against.
Others will provide you with a simulator to connect to.
In the latter two cases you would be testing in production prior to taking the application fully live by switching to the production payment gateway. In the first case, you'd be testing live in production.
Some other factors I've run into with testing payment gateways and applications that use them:
- Payment gateways that allow test card numbers are rare.
- Testing gateways are not necessarily active all the time. You may have to arrange with the provider to have the test gateway available for release testing.
- Testing gateways can have bugs that don't occur in production.
- Testing gateways often have special amount conditions to allow applications using that provider to check all the possible responses from the payment provider (e.g. an order total ending in .01 will return a payment declined message)
- Simulators are even more likely to have bugs that don't occur in production.
- Simulators are often not updated when the production payment gateway is updated. This could mean that some supported card types aren't available via the simulator where they are available live.
- On the positive side, simulators often include detailed logging of payment requests and responses.
- Some simulators can be configured to allow specific card numbers.