how do i code a new payment gateway?

payfast payment gateway