Download the PHP package academe/authorizenet-objects without Composer
On this page you can find all versions of the php package academe/authorizenet-objects. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download academe/authorizenet-objects
More information about academe/authorizenet-objects
Files in academe/authorizenet-objects
Package authorizenet-objects
Short Description Authorize.Net API Message Value Objects
License MIT
Homepage https://github.com/academe/authorizenet-objects
Informations about the package authorizenet-objects
PHP Value Objects for Authorize.Net
The aim of this pacjage is to model, as value objects, all the data structures defined here: http://developer.authorize.net/api/reference/
The data structure for the API messages is defined in the XSD DTD. Although that is for the XSL API, the JSON API mirrors it closely. This DTD has been parsed into this documentation page using xs3p.xsl, which can be a little easier to read, and contains fewer errors than the official HTML documentation. Practically, use the two together.
General Project Stucture
The request messages are under Academe\AuthorizeNet\Request
.
All these requests take a Academe\AuthorizeNet\Auth\MerchantAuthentication
object
to provide authentication and one or more additional objects to carry the main
message detail.
The Academe\AuthorizeNet\Request\CreateTransaction
message takes a transaction
object from under Academe\AuthorizeNet\Request\Transaction
.
The Transaction
object is built mainly from scalar data and other objects under
Academe\AuthorizeNet\Request\Model
.
There are collections under Academe\AuthorizeNet\Collections
used to group some
of the Model
objects, for example LineItems
or UserFields
.
These Collections
may be moved to Academe\AuthorizeNet\Request
at some point,
so be ready for that.
Note: this documentation is sparse at the moment, but the code covers much of the API.
Examples
One package that uses this package is the Authorize.Net API driver for the Omnipay project.
Further libraries can then wrap these objects into a gateway driver.
Any request object, once constructed, can be serialised to JSON (json_encode()
)
to provide the body of the request that the API will expect.
The response from Authorize.Net will be a JSON structure, which can be parsed by the application. The intention is also to create a factory in this package that will parse the response into value objects and collections. Many of the response value objects have been created, but there is no factory yet to fill them up with data.
This can be sent to the gateway simply (and naively, just for demonstration) using Guzzle:
This response data can then be parsed into nested objects: