cancel
Showing results for 
Search instead for 
Did you mean: 

Using PHP SDK Credit response has invalid format.

Hello, I am using the php SDK to run credits to a CP account.

 

When I use the following code:

 

$auth = new AuthorizeNetAIM(LOGIN, KEY);
$auth->setFields(
array(
'amount' => 12.12,
'card_num' => 1234
)
);
$auth->setCustomField('x_ref_trans_id', 123456789);
$auth->setCustomField('x_market_type', 2);
$auth->setCustomField('x_device_type', 5);
$auth->setCustomField('x_response_format', 1);
$auth->setCustomField('x_invoice_num', 545454);

$response = $auth->credit();

My response looks like this:

|1.0|,|1|,|1|,|This transaction has been approved.|,||,|P|,||,|TRANSID|,|D9B0C5C38B9BED87E03AED3124A5F018|,||,||,||,||,||,||,||,||,||,||,||,|XXXX1234|,|MasterCard|

 

$response:

AuthorizeNetAIM_Response Object
(
    [_response_array:AuthorizeNetAIM_Response:private] => Array
        (
            [0] => 1.0
            [1] => 1
            [2] => 1
            [3] => This transaction has been approved.
            [4] => 
            [5] => P
            [6] => 
            [7] => TRANSID
            [8] => D9B0C5C38B9BED87E03AED3124A5F018
            [9] => 
            [10] => 
            [11] => 
            [12] => 
            [13] => 
            [14] => 
            [15] => 
            [16] => 
            [17] => 
            [18] => 
            [19] => 
            [20] => XXXX1234
            [21] => MasterCard
        )

    [approved] => 1
    [declined] => 
    [error] => 
    [held] => 
    [response_code] => 1.0
    [response_subcode] => 1
    [response_reason_code] => 1
    [response_reason_text] => This transaction has been approved.
    [authorization_code] => 
    [avs_response] => P
    [transaction_id] => 
    [invoice_number] => TRANSID
    [description] => D9B0C5C38B9BED87E03AED3124A5F018
    [amount] => 
    [method] => 
    [transaction_type] => 
    [customer_id] => 
    [first_name] => 
    [last_name] => 
    [company] => 
    [address] => 
    [city] => 
    [state] => 
    [zip_code] => 
    [country] => XXXX1234
    [phone] => MasterCard
    [fax] => 
    [email_address] => 
    [ship_to_first_name] => 
    [ship_to_last_name] => 
    [ship_to_company] => 
    [ship_to_address] => 
    [ship_to_city] => 
    [ship_to_state] => 
    [ship_to_zip_code] => 
    [ship_to_country] => 
    [tax] => 
    [duty] => 
    [freight] => 
    [tax_exempt] => 
    [purchase_order_number] => 
    [md5_hash] => 
    [card_code_response] => 
    [cavv_response] => 
    [account_number] => 
    [card_type] => 
    [split_tender_id] => 
    [requested_amount] => 
    [balance_on_card] => 
    [response] => |1.0|,|1|,|1|,|This transaction has been approved.|,||,|P|,||,|TRANSID|,|D9B0C5C38B9BED87E03AED3124A5F018|,||,||,||,||,||,||,||,||,||,||,||,|XXXX1234|,|MasterCard|
    [x_ref_trans_id] => 
    [x_market_type] => 
    [x_device_type] => 
    [x_response_format] => XXXX1234
    [x_invoice_num] => MasterCard
)

The transaction id is being passed back in the invoice id field and I'm not sure what the description field is. Also it appears the country and phone contain the card number and type.

 

Any ideas?

bones
Member
1 ACCEPTED SOLUTION

Accepted Solutions

Use the CP version as shown

anet_php_sdk-1.1.8.zip\anet_php_sdk\tests\AuthorizeNetCP_Test.php

 

the CP response have the version# on index 0 which push everything else down.

View solution in original post

RaynorC1emen7
Expert
3 REPLIES 3

There is already a

RaynorC1emen7
Expert

Use the CP version as shown

anet_php_sdk-1.1.8.zip\anet_php_sdk\tests\AuthorizeNetCP_Test.php

 

the CP response have the version# on index 0 which push everything else down.

RaynorC1emen7
Expert

Thanks!  Simply changing my code from

 

$auth = new AuthorizeNetAIM(LOGIN, KEY);

to

$auth = new AuthorizeNetCP(LOGIN, KEY);

Fixed the issue.