Git Product home page Git Product logo

authorize.net-xml's Introduction

AuthnetXML

A PHP class that abstracts the Authorize.Net XML API

This class is deprecated. It is recommended that you use the AuthnetJson PHP package instead.

Requirements:

Installation

Include the 'AuthnetXML.class.php' and 'config.inc.php' files in your application.

Usage Examples:

See the individual examples in each of the APIs' directory

Test Credit Card Numbers:

Set the expiration date to anytime in the future.

  • American Express Test Card -> 370000000000002
  • Discover Test Card -> 6011000000000012
  • Visa Test Card -> 4007000000027
  • Second Visa Test Card -> 4012888818888
  • JCB -> 3088000000000017
  • Diners Club/ Carte Blanche -> 38000000000006

Authorize.Net API Reference

https://developer.authorize.net/api/reference/index.html

authorize.net-xml's People

Contributors

cbowmanaz avatar shennyg avatar stymiee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

authorize.net-xml's Issues

Can't represent transactionSettings XML as an array.

The problem is that you can't have duplicate keys at the same level in an array. If you do the last one entered wins and the rest are overwritten.

So you need a way to represent repeating items from XML in and array. I decide to use the JSON methods to keep it simple. A quick wat to convert Simple XML to and array is to pass it through JSON.

$array = json_decode( json_encode( $simpleXML), true);

That will convert XML like this:

<transactionSettings>
  <setting>
    <settingName>allowPartialAuth</settingName>
    <settingValue>false</settingValue>
  </setting>
  <setting>
    <settingName>duplicateWindow</settingName>
    <settingValue>0</settingValue>
  </setting>
  <setting>
    <settingName>emailCustomer</settingName>
    <settingValue>false</settingValue>
  </setting>
  <setting>
    <settingName>recurringBilling</settingName>
    <settingValue>false</settingValue>
  </setting>
  <setting>
    <settingName>testRequest</settingName>
    <settingValue>false</settingValue>
  </setting>
</transactionSettings>
 

To an array like this:

array(
'transactionSettings' => array(  
  'setting' => array(
    0 => array('settingName' =>'allowPartialAuth' ,  'settingValue' => 'false',),
    1 => array('settingName' => 'duplicateWindow', 'settingValue' => '0', ),
    2 => array('settingName' => 'emailCustomer', 'settingValue' => 'false', ),
    3 => array('settingName' => 'recurringBilling', 'settingValue' => 'false',),
    4 => array( 'settingName' => 'testRequest', false, ),
  )
);

So you need to modify AuthNetXML.class to recognize this format. Just replace your setParameters() method with:

  private function setParameters($xml, $array)
  {
    if (is_array($array))
    {
      $first = true;

```
  foreach ($array as $key => $value)
  {
    if (is_array($value)) {

      if( is_numeric($key) )  {
        if($first){
          $xmlx = $xml;
          $first = false;
        } else {
          $parent = $xml->xpath('parent::*');
          $xmlx = $parent[0]->addChild($xml->getName());
        }

      } else {

        $xmlx = $xml->addChild($key);

      }

      $this->setParameters($xmlx, $value);
    }
    else
    {
      $xml->$key = $value;
    }
  }
}
```

  }

Managing payments in iframe

Thanks for the great class.

Authorize.net SDK explains a way that stored payment information can be managed via an iframe that can be placed on a website. I was just wondering if it'd be possible to add this functionality to this class as well so we don't have to switch to the sdk to accomplish it.

Access Denied from Authorize.net

I'm receiving the following error message when testing in Authorize.net sandbox. I'm not sure the exact issue but I'm assuming it has to do with SSL verification:

Access Denied

You don't have permission to access "http://apitest.authorize.net/xml/v1/request.api" on this server.

Reference #18.162f0660.1451338826.3f12ff2

It is in fact hitting the HTTPS API url: https://apitest.authorize.net/xml/v1/request.api

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /var/www/vhosts/recurring.givewp.com/recurring3.givewp.com/wp-content/plugins/Give-Recurring-Donations/lib/AuthnetXML/AuthnetXML.class.php:203 Stack trace: #0 /var/www/vhosts/recurring.givewp.com/recurring3.givewp.com/wp-content/plugins/Give-Recurring-Donations/lib/AuthnetXML/AuthnetXML.class.php(203): SimpleXMLElement->__construct('<HTML><HEAD>?<T...') #1 /var/www/vhosts/recurring.givewp.com/recurring3.givewp.com/wp-content/plugins/Give-Recurring-Donations/lib/AuthnetXML/AuthnetXML.class.php(149): AuthnetXML->process() #2 /var/www/vhosts/recurring.givewp.com/recurring3.givewp.com/wp-content/plugins/Give-Recurring-Donations/includes/gateways/give-recurring-authorize.php(124): AuthnetXML->__call('ARBCreateSubscr...', Array) #3 /var/www/vhosts/recurring.givewp.com/recurring3.givewp.com/wp-content/plugins/Give-Recurring-Donations/includes/gateways/give-recurring-authorize.php(124): AuthnetXML->ARBCreateSubscriptionRequest(Array) # in /var/www/vhosts/recurring.givewp.com/recurring3.givewp.com/wp-content/plugins/Give-Recurring-Donations/lib/AuthnetXML/AuthnetXML.class.php on line 203

I'm not sure if it's an error with the server setup, this script, or something else? Any insight is appreciated...

12-28-2015 1-54-50 pm

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.