Giter VIP home page Giter VIP logo

sdk-php's Introduction

Authorize.Net PHP SDK

Travis CI Status Scrutinizer Code Quality Packagist Stable Version

Requirements

  • PHP 5.6+
  • cURL PHP Extension
  • JSON PHP Extension
  • An Authorize.Net account (see Registration & Configuration section below)
  • TLS 1.2 capable versions of libcurl and OpenSSL (or its equivalent)

Migrating from older versions

Since August 2018, the Authorize.Net API has been reorganized to be more merchant focused. Authorize.Net AIM, ARB, CIM, Transaction Reporting, and SIM classes have been deprecated in favor of net\authorize\api. To see the full list of mapping of new features corresponding to the deprecated features, see MIGRATING.md.

Contribution

TLS 1.2

The Authorize.Net APIs only support connections using the TLS 1.2 security protocol. Make sure to upgrade all required components to support TLS 1.2. Keep these components up to date to mitigate the risk of new security flaws.

To test whether your current installation is capable of communicating to our servers using TLS 1.2, run the following PHP code and examine the output for the TLS version:

<?php
    $ch = curl_init('https://apitest.authorize.net/xml/v1/request.api');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_VERBOSE, true);
    $data = curl_exec($ch);
    curl_close($ch);

If curl is unable to connect to our URL (as given in the previous sample), it's likely that your system is not able to connect using TLS 1.2, or does not have a supported cipher installed. To verify what TLS version your connection does support, run the following PHP code:

<?php 
$ch = curl_init('https://www.howsmyssl.com/a/check');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);

$json = json_decode($data);
echo "Connection uses " . $json->tls_version ."\n";

Installation

Composer

We recommend using Composer. (Note: we never recommend you override the new secure-http default setting). Update your composer.json file as per the example below and then run for this specific release composer update.

{
  "require": {
  "php": ">=5.6",
  "authorizenet/authorizenet": "2.0.2"
  }
}

After installation through Composer, don't forget to require its autoloader in your script or bootstrap file:

require 'vendor/autoload.php';

Custom SPL Autoloader

Alternatively, we provide a custom SPL autoloader for you to reference from within your PHP file:

require 'path/to/anet_php_sdk/autoload.php';

This autoloader still requires the vendor directory and all of its dependencies to exist. However, this is a possible solution for cases where composer can't be run on a given system. You can run composer locally or on another system to build the directory, then copy the vendor directory to the desired system.

Registration & Configuration

Use of this SDK and the Authorize.Net APIs requires having an account on the Authorize.Net system. You can find these details in the Settings section. If you don't currently have a production Authorize.Net account, sign up for a sandbox account.

Authentication

To authenticate with the Authorize.Net API, use your account's API Login ID and Transaction Key. If you don't have these credentials, obtain them from the Merchant Interface. For production accounts, the Merchant Interface is located at (https://account.authorize.net/), and for sandbox accounts, at (https://sandbox.authorize.net).

After you have your credentials, load them into the appropriate variables in your code. The below sample code shows how to set the credentials as part of the API request.

To set your API credentials for an API request:

...

use net\authorize\api\contract\v1 as AnetAPI;

...

$merchantAuthentication = new AnetAPI\MerchantAuthenticationType();
$merchantAuthentication->setName("YOURLOGIN");
$merchantAuthentication->setTransactionKey("YOURKEY");

...

$request = new AnetAPI\CreateTransactionRequest();
$request->setMerchantAuthentication($merchantAuthentication);

...

You should never include your Login ID and Transaction Key directly in a PHP file that's in a publically accessible portion of your website. A better practice would be to define these in a constants file, and then reference those constants in the appropriate place in your code.

Switching between the sandbox environment and the production environment

Authorize.Net maintains a complete sandbox environment for testing and development purposes. The sandbox environment is an exact replica of our production environment, with simulated transaction authorization and settlement. By default, this SDK is configured to use the sandbox environment. To switch to the production environment, replace the environment constant in the execute method. For example:

// For PRODUCTION use
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::PRODUCTION);

API credentials are different for each environment, so be sure to switch to the appropriate credentials when switching environments.

SDK Usage Examples and Sample Code

To get started using this SDK, it's highly recommended to download our sample code repository:

In that respository, we have comprehensive sample code for all common uses of our API:

Additionally, you can find details and examples of how our API is structured in our API Reference Guide:

The API Reference Guide provides examples of what information is needed for a particular request and how that information would be formatted. Using those examples, you can easily determine what methods would be necessary to include that information in a request using this SDK.

Building & Testing the SDK

Integration tests for the AuthorizeNet SDK are in the tests directory. These tests are mainly for SDK development. However, you can also browse through them to find more usage examples for the various APIs.

  • Run composer update --dev to load the PHPUnit test library.
  • Copy the phpunit.xml.dist file to phpunit.xml and enter your merchant credentials in the constant fields.
  • Run vendor/bin/phpunit to run the test suite.

You'll probably want to disable emails on your sandbox account.

Testing Guide

For additional help in testing your own code, Authorize.Net maintains a comprehensive testing guide that includes test credit card numbers to use and special triggers to generate certain responses from the sandbox environment.

Logging

The SDK generates a log with masking for sensitive data like credit card, expiration dates. The provided levels for logging are debug, info, warn, error. Add use \net\authorize\util\LogFactory;. Logger can be initialized using $logger = LogFactory::getLog(get_class($this)); The default log file phplog gets generated in the current folder. The subsequent logs are appended to the same file, unless the execution folder is changed, and a new log file is generated.

Usage Examples

  • Logging a string message $logger->debug("Sending 'XML' Request type");
  • Logging xml strings $logger->debug($xmlRequest);
  • Logging using formatting $logger->debugFormat("Integer: %d, Float: %f, Xml-Request: %s\n", array(100, 1.29f, $xmlRequest));

Customizing Sensitive Tags

A local copy of AuthorizedNetSensitiveTagsConfig.json gets generated when code invoking the logger first gets executed. The local file can later be edited by developer to re-configure what is masked and what is visible. (Do not edit the JSON in the SDK).

  • For each element of the sensitiveTags array,
    • tagName field corresponds to the name of the property in object, or xml-tag that should be hidden entirely ( XXXX shown if no replacement specified ) or masked (e.g. showing the last 4 digits of credit card number).
    • pattern[Note] and replacement[Note] can be left "", if the default is to be used (as defined in Log.php). pattern gives the regex to identify, while replacement defines the visible part.
    • disableMask can be set to true to allow the log to fully display that property in an object, or tag in a xml string.
  • sensitiveStringRegexes[Note] has list of credit-card regexes. So if credit-card number is not already masked, it would get entirely masked.
  • Take care of non-ascii characters (refer manual) while defining the regex, e.g. use "pattern": "(\\p{N}+)(\\p{N}{4})" instead of "pattern": "(\\d+)(\\d{4})". Also note \\ escape sequence is used.

Note: For any regex, no starting or ending '/' or any other delimiter should be defined. The '/' delimiter and unicode flag is added in the code.

Transaction Hash Upgrade

Authorize.Net is phasing out the MD5 based transHash element in favor of the SHA-512 based transHashSHA2. The setting in the Merchant Interface which controlled the MD5 Hash option is no longer available, and the transHash element will stop returning values at a later date to be determined. For information on how to use transHashSHA2, see the [Transaction Hash Upgrade Guide] (https://developer.authorize.net/support/hash_upgrade/).

License

This repository is distributed under a proprietary license. See the provided LICENSE.txt file.

sdk-php's People

Contributors

0b10011 avatar adavidw avatar adear11 avatar akankaria avatar anuragg29 avatar apropos avatar ashtru avatar brianmc avatar devkale avatar drmonkeyninja avatar fulldecent avatar funkjedi avatar gnongsie avatar goetas avatar khaaldrogo avatar kikmak42 avatar lakshmisundar avatar mfurlend avatar mordy avatar namanbansal avatar ncpga avatar rahulrnitc avatar ramittal avatar scrutinizer-auto-fixer avatar shahariaazam avatar srmisra avatar szimmerman123 avatar texdc avatar trevorw avatar vyoam 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  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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdk-php's Issues

missing createCustomerProfileFromTransaction

I use this function ALL THE TIME, I also push everything to my server with git autodeploy webhook that does a composer install (Envoyer.io). I have to SSH into my server every time I deploy to add this function to AuthorizeNetCIM.php

/**
* @param $transId
* @return AuthorizeNetCIM_Response
*/
public function createCustomerProfileFromTransaction($transId)
{
$this->_constructXml("createCustomerProfileFromTransactionRequest");
$this->_xml->addChild("transId", $transId);
return $this->_sendRequest();
}

Seems SDK bug with LineItems

I m using Authorize.net SDK 1.8.3.3 , SDK 1.8.3.1 Also have same problem

Issue: LineItems in Transaction Request not adds "quantity" key value pair if quantity is '0'. Which causes error in response.

Line Items Trace:

array (size=2)
  0 => 
    object(AuthorizeNetLineItem)[71]
      public 'itemId' => string '1' (length=1)
      public 'name' => string 'xxxItem1' (length=14)
      public 'description' => string '' (length=0)
      public 'quantity' => string '0' (length=1)
      public 'unitPrice' => string '8.99' (length=4)
      public 'taxable' => string 'false' (length=5)
  1 => 
    object(AuthorizeNetLineItem)[68]
      public 'itemId' => string '2' (length=1)
      public 'name' => string 'xxxxItem2' (length=15)
      public 'description' => string '' (length=0)
      public 'quantity' => string '300' (length=3)
      public 'unitPrice' => string '9.99' (length=4)
      public 'taxable' => string 'false' (length=5)

Transaction Request trace:

 [transaction] => SimpleXMLElement Object
                (
                    [profileTransAuthCapture] => SimpleXMLElement Object
                        (
                            [amount] => 9.95
                            [lineItems] => Array
                                (
                                    [0] => SimpleXMLElement Object
                                        (
                                            [itemId] => 1
                                            [name] => xxxItem1
                                            [unitPrice] => 8.99
                                            [taxable] => false
                                        )

                                    [1] => SimpleXMLElement Object
                                        (
                                            [itemId] => 2
                                            [name] => xxxItem2
                                            [quantity] => 300
                                            [unitPrice] => 9.99
                                            [taxable] => false
                                        )

Response Trace:

<?xml version="1.0" encoding="utf-8"?><ErrorResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Error</resultCode><message><code>E00003</code><text>The element 'lineItems' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'unitPrice' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'description, quantity' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.</text></message></messages></ErrorResponse>

Note: Line Item must accept item with quantity as 0 where Line Item cost would be calculated as 0

Response issue for ARB getSubscriptionStatus

getSubscriptionStatus reads "Status" with a capital "S", while it should read "status", see sdk-php//lib/AuthorizeNetARB.php

They're both being sent with the response and "Status" was always "active" on my tests, while "status" had the correct value.

Add documentation for API authentication

Currently I can't find any documentation on how to get my authentication working.

I'm sure the functionality is there, but it isn't included in any of the docs.

New Model suggestions

We've recently run into the requirement of using CIM profiles through transactions. I believe the "old" AIM approach doesn't cover this so that's the primary motivation for my switch to the new model.

I have a few suggestions:

  • Utilize constructors with null/default values
    • This lets me know what parameters are required
    • It turns multiple line set calls into a single line constructor
    • The "old model" utilized this on almost all types and it makes the transition much easier as statements become almost 1:1
  • Expose internal properties as public, leaving getters and setters for sensitive information
    • payment->creditCard->cardNumber is easier to read than getPayment()->getCreditCard()->getCardNumber()
    • Exposing the internal types allows things like json_encode() to just work. I encode the entire response->xml object, trimming sensitive information for logging purposes (and to replay the conditions of the call).
  • HttpClient gives a warning on file_put_contents if you don't have a log file set
    • I'm either required to set it or turn off error reporting and I'd rather do neither of those. I'd rather it just not matter if it couldn't log information I don't care to log.

Overall, I really do prefer this approach once I got through some of the transition. I feel it follows http://developer.authorize.net/api/reference/index.html much more closely. The few tweaks above should make the transition from the old model to the new much easier.

Using Logging Mechanism inadvertently Storing CC info

Hi,

We are using CIM and are using Auth.net to handle storing all of our CC info.

We are also using the built in logging mechanisms in the SDK to troubleshoot any issues we have.

The problem is that when you make a createCustomerPaymentProfileRequest, one of the fields is the CC number so that is stored in plain text in the log file.

Is there anyway you could update the logging to mask the actual CC number and cvv code so we can continue to use the logging, but also not have access to the sensitive data?

No examples for createCustomerPaymentProfile that provide more than basic parameters

I've scoured the internet looking for PHP code examples that use this sdk to create a payment profile (createCustomerPaymentProfile) and have yet to find one that provides more than just customerType, cardNumber, and expirationDate. That's barely a fraction of the perhaps two dozen inputs described on page 24 of the CIM XML guide:
http://www.authorize.net/support/CIM_XML_guide.pdf

Given that this SDK uses irregular nested object structures and doesn't have any javadoc comments to elucidate what they are for (or to even standardize what methods and properties an instance of AuthorizeNetPaymentProfile->payment->creditCard might have), it would be most helpful if your project were to provide an example of how to create a payment profile while supplying this additional information.

PHP notice for empty CMI customers

When querying CMI in sandbox mode (and probably also if no customers exist yet), I receive a PHP notice.

$request = new AuthorizeNetCIM;
$response = $request->getCustomerProfileIds();
$customers = $response->getCustomerProfileIds();
A PHP Error was encountered
Severity: Notice
Message: Undefined index: numericString
Filename: lib/AuthorizeNetCIM.php
Line Number: 491

The $this->xml->ids property is empty if there are no customers, and hence it can't access the "numericString" values.

CIM.markdown lacks examples to supply billing address or CCV number

This documentation is hardly detailed:
https://github.com/AuthorizeNet/sdk-php/blob/master/doc/CIM.markdown

How does one supply the CCV card number when creating a payment profile? How about a billing address?

Also, who does this?

$this->tax = (object)array();

Have you never heard of stdClass?
QV: http://php.net/manual/en/reserved.classes.php

Finally, why a generic object in this case? Too lazy to define an actual object with proper JavaDoc comments? And how about some validation? This SDK needs a lot of work.

Dependency issue

In tag 1.8.3 the composer.json file indicated a dependency on "jms/serializer": “*”. In subsequent versions, your composer file indicates a dependency on "jms/serializer": "xsd2php-dev as 0.18.0" but it does not seem like that version of serializer package is available?

https://packagist.org/packages/jms/serializer

authorizenet/authorizenet 1.8.5.1 requires jms/serializer xsd2php-dev as 0
.18.0 -> no matching package found.

Need to make $_xml accessible for logging

While it is possible to save transactional data to a log file, this gets unwieldy to leave on for any length of time. Thus, I would like to save the transactional data to my database.

To do this, I need access to the _xml class variable which is protected. Can someone add a public getter method that retrieves the xml sent and the xml received, respectively?

Thanks,
Steve

XML Element Name mistyped

sdk-php / lib / AuthorizeNetARB.php : Line 171

For an already canceled ARB subscription, and when querying the status of the subscription with getSubscriptionStatus, the element "Status" in the response is 'active' and the element "status" (small 's') is 'canceled'

 ...
  <status>canceled</status>
  <Status>active</Status>
</ARBGetSubscriptionStatusResponse>

Remove Verify_Peer Exploit

Line 14 of AuthorizeNetRequest.php

public $VERIFY_PEER = true; // Set to false if getting connection errors.

94 through 98

    if ($this->VERIFY_PEER) {
        curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)) . '/ssl/cert.pem');
    } else {
        curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false);
    }

This is bad advice, bad code, and will result in connection errors turning into MITM exploits via peerjacking. Fix the code and issue a USN.

This was initially reported in 2011 and is apparently still not fixed, http://www.unrest.ca/peerjacking

AuthorizeNetCIM_Response::getTransactionResponse returns spurious connection error

If one uses a CIM request to charge a non-existent user, your gateway responds with a well-formed response:

<?xml version="1.0" encoding="utf-8"?><createCustomerProfileTransactionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Error</resultCode><message><code>E00040</code><text>Customer Profile ID or Customer Payment Profile ID not found.</text></message></messages></createCustomerProfileTransactionResponse>

HOWEVER, your code returns an AuthorizeNetAIM_Response object that says there was a connection problem. This problem would apparently be due to the fact that the getTransactionResponse function is trying to parse a non-existent XML element, directResponse:

    public function getTransactionResponse()
    {
        return new AuthorizeNetAIM_Response($this->_getElementContents("directResponse"), ",", "|", array());
    }

See https://github.com/AuthorizeNet/sdk-php/blob/master/lib/AuthorizeNetCIM.php#L459

Your code should be at least intelligent enough to recognize that it has in fact connected the gateway successfully and parse out the appropriate error message. Jeeze.

authorizenet 1.8.5 requires jms/serializer xsd2php-dev as 0.18.0

I get this error when I try and update the SDK to the latest version (happens on 1.8.5.1)

Problem 1

  • Installation request for authorizenet/authorizenet 1.8.5 -> satisfiable by authorizenet/authorizenet[1.8.5].
  • authorizenet/authorizenet 1.8.5 requires jms/serializer xsd2php-dev as 0.18.0 -> no matching package found.

Merge was from here: c43a425

"undefined property" error for _custom_fields

Reported by tdietsche9 http://community.developer.authorize.net/t5/Integration-and-Testing/Card-Present-PHP-SDK-BUG/m-p/40220#M21872

Comparing the new and old AuthorizeNetCP.php files shows that only the
"undefined offset" errors were fixed. The "undefined property" error was NOT fixed.
It doesn't define a class property for _custom_fields (like AuthorizeNetAIM.php does).

I added this code after line 50 and it seems to prevent this php error:

/**
 * Only used if merchant wants to send custom fields.
 */
private $_custom_fields = array();

Also, the "error_message" property is only defined and returned if there IS an error.
It would be better if it always returned a value (empty string if trx is approved, otherwise an error message string). I fixed my script to only obtain the value of this response property if there was an error, not always.

Certificates

Do the certificates need to be updated? I've been unable to connect with ssl the last 2 days (for sandbox). I went to test.authorize.net and downloaded the certs and it appears to be working with the downloaded ones.

Subscriptions (ARB) are created without CC validation

If I send this in for a subscription to a production account:

$subscription = new AuthorizeNet_Subscription;
$subscription->name = "Short subscription";
$subscription->intervalLength = "12";
$subscription->intervalUnit = "months";
$subscription->startDate = "2015-11-20";
$subscription->totalOccurrences = "9999";
$subscription->amount = 235;
$subscription->creditCardCardNumber = "5551766170335085";
$subscription->creditCardExpirationDate = "2018-03";
$subscription->creditCardCardCode = "897";
$subscription->billToFirstName = "Happy";
$subscription->billToLastName = "Gilmore";

The CC info is bogus, but it does validate as a proper card number.

This is my response:

AuthorizeNetARB_Response Object
(
    [xml] => SimpleXMLElement Object
        (
            [messages] => SimpleXMLElement Object
                (
                    [resultCode] => Ok
                    [message] => SimpleXMLElement Object
                        (
                            [code] => I00001
                            [text] => Successful.
                        )

                )

            [subscriptionId] => 26519381
        )

    [response] => OkI00001Successful.26519381
    [xpath_xml] => SimpleXMLElement Object
        (
            [messages] => SimpleXMLElement Object
                (
                    [resultCode] => Ok
                    [message] => SimpleXMLElement Object
                        (
                            [code] => I00001
                            [text] => Successful.
                        )

                )

            [subscriptionId] => 26519381
        )

)

From what I've gathered subscriptions are processed in batch at 2am or something, but is there no type of validation done on the information submitted prior to that batch processing?

AuthorizeNet_Subscription is not escaping values for inclusion in XML

If one needs to create a subscription for a credit-card registered to "Jim & Jane Plain", for example, this is problematic; invalid XML will be produced. The escaping should probably extend to every field that could conceivably have an ampersand, which would easily include company, address -- probably even country (though usually it's best to just escape everything for good measure).

For my purposes I only needed the name fields escaped (for now), so I patched my local copy of AuthorizeNetTypes.php, adding a method to AuthorizeNet_Subscription like this:

/**
 * Escape the given string for inclusion in XML.
 */
private function escape($s) {
    return htmlspecialchars($s, ENT_QUOTES | ENT_XML1);
}

Then I escape the values like this:

<firstName>{$this->escape($this->billToFirstName)}</firstName>
<lastName>{$this->escape($this->billToLastName)}</lastName>

Getting error while run composer update command

Error is following :

swati@swati-pc:/opt/lampp/htdocs/sdk-php-master$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package authorizenet/authorizenet No version set (parsed as 1.0.0) could not be found.

Potential causes:

Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

Full CC Number and CVV info are stored in the log file

If you provide a log file name in the AUTHORIZENET_LOG_FILE, the log file will dutifully store the XML sent to Authorize.net, including the credit card number and the CVV value. If you're trying to adhere to PCI compliance rules, this is a violation, and a pretty egregious one at that since the data are stored unencrypted in the clear. It also violates the credit card vendors' rules against ever storing the CVV in any way.

My suggestion would be to obfuscate the card number with Xs and reveal only the last four digits of the card number. I would also obfuscate the entire CVV with Xs. A fancy version would make this an optional switch that is on by default, meaning I, the developer, have to set a flag explicitly to store these values in the clear.

Thanks,
Steve

Issue with CIM - getValidationResponse()

This is a problem I've encountered with the version 1.8.3.1 SDK using the Authorize.net sandbox server. I'm currently unable to test it on the live server.

This function in the AuthorizeNetCIM_Response class,

public function getValidationResponse()
{
  return new AuthorizeNetAIM_Response($this->_getElementContents("validationDirectResponse"), ",", "|", array());
}

is passing the AuthorizeNetAIM_Response constructor an $encap_char value of "|". However, the Authorize.net server isn't using an encapsulating character, so the AuthorizeNetAIM_Response fields fail to populate. Reverting the $encap_char value back to "", like it was in version 1.1.8, fixes the problem.

The related AuthorizeNetCIM_Response::getValidationResponses() function is still using a value of "" for $encap_char.

How to search/get a profile based on merchantCustomerID instead profileID

As I understand it, the customerProfileID is something Auth.Net assigns.
But merchantCustomerID is something I assign at creation.

that means if I can only get a customer profile using profileID, I need to store that profileID on my side...

But... HOW can I fetch a profile based on merchantCustomerID instead so that I dont need to do that?

Getter and setter inconsistencies

This project is incredibly inconsistent. For the AuthorizeNetAIM class, properties can be set magically or using the setField() function. On the response properties are accessed directly without getter functions.

On the AuthorizeNet_Subscription() class, properties are set directly without setters. On the AuthorizeNetARB_Response class, there are getter methods for all the properties.

Can you please unify and standardize this across all classes?

Name cannot begin with the '0' character, hexadecimal value 0x30.

Hello Team,

I am facing this issue and am not able to fix it. can you guys please suggest me why is it showing error. This code creates Customer profile ID, Payment Profile ID and saving address successfully but when i make transaction it give error. Please help me. Thanks

My Code:

   $customerProfile = new AuthorizeNetCustomer;
   $customerProfile->description = "Description of customer";
   $customerProfile->merchantCustomerId = $user->id;
   $customerProfile->email = $user->email;
   $address = new AuthorizeNetAddress;
   $address->firstName = "john";
   $address->lastName = "Doe";
   $address->phoneNumber = "555-555-5555";
   $customerProfile->shipToList[] = $address;

   $paymentProfile = new AuthorizeNetPaymentProfile;
   $paymentProfile->customerType = "individual";
   $paymentProfile->payment->creditCard->cardNumber = "4111111111111111";
   $paymentProfile->payment->creditCard->expirationDate = "2017-10";
   $customerProfile->paymentProfiles[] = $paymentProfile;

   $request = new AuthorizeNetCIM;
   $response = $request->createCustomerProfile($customerProfile);
   $new_customer_id = $response->xml->customerProfileId;
   $paymentProfileId = $response->xml->customerPaymentProfileIdList->numericString;
   $customerAddressId = $response->xml->customerShippingAddressIdList->numericString;

   $transaction = new AuthorizeNetTransaction;
   $transaction->amount = "9.79";
   $transaction->customerProfileId = $new_customer_id;
   $transaction->customerPaymentProfileId = $paymentProfileId;
   $transaction->customerShippingAddressId = $customerAddressId;

   $transaction->cardCode = "111";
   $response = $request->createCustomerProfileTransaction("AuthCapture", $transaction);
   print_r($response); 

Error -

[code] => E00003
[text] => Name cannot begin with the '0' character, hexadecimal value 0x30. Line 2, position 291.

Multiple payment profile IDS

$an = new AuthorizeNetCIM();
$result = $an->getCustomerProfile(xxxxxx);    //xxxxxx is customer profile ID
var_dump($result->getCustomerPaymentProfileIds());

And I discovered there is no numericStrings when I am calling getCustomerProfile(xxxxxx) in the response. So either the response is different or the extraction of ids are wrong! (just for deep digging purpose)

getCustomerPaymentProfileIds is returning null all the time when this customer has multiple payment profile

file_put_contents(phplog): failed to open stream: Permission denied

There is a weird issue that was not happening few days/weeks ago.

It keeps looking for phplog file, I've defined (as for the php-samples) my AUTHORIZENET_LOG_FILE but it looks like it's not being used.

Looking at the source or the error, here is where is being defined ANET_LOG_FILE with phplog.

Deleting/changing that line from that file solves the issue.
I've personally deleted that line and defined ANET_LOG_FILE when I set the credentials (instead of AUTHORIZENET_LOG_FILE), it works like a charm.

Fatal Error Class 'Symfony\Component\Yaml\Yaml' not found in

I'm running into a this fatal error:

Fatal error: Class 'Symfony\Component\Yaml\Yaml' not found in ...includes\gateways\authorize-sdk-php\vendor\jms\serializer\src\JMS\Serializer\Metadata\Driver\YamlDriver.php on line 35

I've run composer update and am not sure what the issue is...

Big Issue

My whole system is not charging, Do you know if there is a know issue with this class?

Autoload.php echo

The autoload.php echo's a class not found message when it does not find a class

"
} else {
echo 'Class not loaded: ' . $className;
"

That's OK. However when used with a AJAX within a framework such as Wordpress or Joomla it corrupts the output with class not found messages. This output conflicts with the intended output of the class that instantiates the A.NET class. So, if the php program being called by a jQuery script via $.post and the php returns die(json_encode($output)); the return contains all the echo from the autoload, which are not relevant.

PHP 7

We are currently testing PHP 7 Support using the current RC5 to try to get ahead of the curve. However when installing the Authorize.net PHP SDK with composer we're stuck:

authorizenet/authorizenet dev-master requires php ~5.3 -> your PHP version (7.0.0RC5) or "config.platform.php" value does not satisfy that requirement.

Could we get the PHP version changed in the composer.json file to something like >=5.3 instead of ~5.3? I'll make the PR is needed, that's no big deal. I don't see anything in the code base that would cause problems unless I've missed something.

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.