SDK Common Objects
Authorize.net provides a php sdk for working with their payment gateway.
There are a few classes that we'll need to get familiar with when working with their sdk.
In order to use the Payment gateway we must be authenticated. The MerchantAuthenticationType class creates an authentication object where we will set the API LOGIN ID and the TRANSACTION KEY. This object will be consumes by CreateTransactionRequest when we create our request object.
When charging a credit card we need to create an object that represents the credit card. The CreditCardType class allows you to do this. We can have the credit card number, expiration date and the security code for the card. This object will be consumed by the PaymentType class.
The PaymentType class is used to specify a type of payment. The payment type can be set as credit card, PayPal or bank account. These correspond to CreditCardType, PayPalType and BankAccountType classes.
The TransactionRequestType class is used to set up the type of transaction. A transaction can be a refund, a authorize only, authorize and capture and more. On this object is also where we set the PaymentType , the order amount, and the order details via the OrderType class.
The CreateTransactionRequest class is used to create a request object. On this request will set the MerchantAuthenticationType authentication object and the TransactionRequestType object. This request object can then be passed to the
CreateTransactionController class which will then execute the request and return a response.
The CreateTransactionController object is used to create a controller that can execute our request object of type CreateTransactionRequest.