PHPackages                             academe/authorizenet-objects - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. academe/authorizenet-objects

ActiveLibrary[Payment Processing](/categories/payments)

academe/authorizenet-objects
============================

Authorize.Net API Message Value Objects

0.7.3(6y ago)8720.6k↓21.1%6[6 issues](https://github.com/academe/authorizenet-objects/issues)[1 PRs](https://github.com/academe/authorizenet-objects/pulls)3MITPHPPHP &gt;=5.6.0

Since Oct 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/academe/authorizenet-objects)[ Packagist](https://packagist.org/packages/academe/authorizenet-objects)[ Docs](https://github.com/academe/authorizenet-objects)[ RSS](/packages/academe-authorizenet-objects/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (8)Used By (3)

PHP Value Objects for Authorize.Net
===================================

[](#php-value-objects-for-authorizenet)

[![Build Status](https://camo.githubusercontent.com/b492a89ce507fbf8371ab13d58aaaee28b73a07045323be1054a027a8b5fe0b7/68747470733a2f2f7472617669732d63692e6f72672f61636164656d652f617574686f72697a656e65742d6f626a656374732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/academe/authorizenet-objects)[![Latest Stable Version](https://camo.githubusercontent.com/a88912277058ab0673d2e48446737e3616ccfdd72ab489ffee98c124346b6891/68747470733a2f2f706f7365722e707567782e6f72672f61636164656d652f617574686f72697a656e65742d6f626a656374732f762f737461626c65)](https://packagist.org/packages/academe/authorizenet-objects)[![Total Downloads](https://camo.githubusercontent.com/c05fa15c20439d1f32c4dede6f77a0466245dc682648a5b5ed759d26037fc0b1/68747470733a2f2f706f7365722e707567782e6f72672f61636164656d652f617574686f72697a656e65742d6f626a656374732f646f776e6c6f616473)](https://packagist.org/packages/academe/authorizenet-objects)[![Latest Unstable Version](https://camo.githubusercontent.com/24c99ddda9f119bd834554f678bf419b6146e238a0da0a308ddb3b01bd18ad7e/68747470733a2f2f706f7365722e707567782e6f72672f61636164656d652f617574686f72697a656e65742d6f626a656374732f762f756e737461626c65)](https://packagist.org/packages/academe/authorizenet-objects)[![License](https://camo.githubusercontent.com/0549efe6280a4e2af3dc19cb8aa87c37cecc9c31a05d9951d50b70875c27decb/68747470733a2f2f706f7365722e707567782e6f72672f61636164656d652f617574686f72697a656e65742d6f626a656374732f6c6963656e7365)](https://packagist.org/packages/academe/authorizenet-objects)

The aim of this pacjage is to model, as value objects, all the data structures defined here:

The data structure for the API messages is defined in the [XSD DTD](https://api.authorize.net/xml/v1/schema/AnetApiSchema.xsd). Although that is for the XSL API, the JSON API mirrors it closely. This DTD has been parsed into [this documentation page](https://academe.github.io/authorizenet-objects/AnetApiSchema.html)using [xs3p.xsl](https://github.com/bitfehler/xs3p), 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
------------------------

[](#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
--------

[](#examples)

One package that uses this package is the [Authorize.Net API](https://github.com/academe/omnipay-authorizenetapi)driver for the [Omnipay](https://omnipay.thephpleague.com/) 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.

```
