The long version is that it'll be much more expensive to write your own, than it is to use an existing one. I would guess it'd cost at least tens of millions (if not HUNDREDS OF MILLIONS) to build that. What would you need? - the actual software (not an easy undertaking) - fraud protection on said software (takes years to develop, ask Paypal, or read their story in "Founders at Work")
On top of that, you have to get the banking industry to allow you to tap into their existing infrastructure. Unless you're a pretty well proven company, this will be a non-starter.
Throw on top of that the cost of compliance (not basic PCI, either -- you'll need top fo the line stuff going on).
Yeah, I'd say it'd cost you > $100 million AND take > 3-5 years to accomplish.
Use an existing payment gateway.