cancel
Showing results for 
Search instead for 
Did you mean: 

New to Authorize.Net and Hello world not working

Hi everyone, I am new to Authorize and I can't get the hello world to work.

 

Error message is

Charge Credit Card ERROR : Invalid response

 

I have installed composer from https://getcomposer.org/download/ and then ran composer update with the following composer.json

 

{
  "require": {
    "php": ">=5.6",
    "ext-curl": "*",
    "authorizenet/authorizenet": ">=1.9.3"
  }
}

 

The hello world script is from here

https://developer.authorize.net/hello_world/

 

I went to the "Test Your Authentication Credentials" from this page and did not get any errors:

 

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

 

My server has PHP 7.1.16

 

Anyone have an idea why I would be getting that error?

ginocyber
Member
2 ACCEPTED SOLUTIONS

Accepted Solutions

 You need to  include this file from Github "sample-code-php/constants/Constants.php", at the very top of your script (charge-credit-card.php for exemple), and it will work fine.

 

 





Send feedback at developer_feedback@authorize.net

View solution in original post

in your use case i will recommend to leverage our customer profiles features . 

 

You can call it to create the customer and payment profile for each member and then pass the paymentProfile ID for createTransaction when you want to charge . 

 

More details at https://developer.authorize.net/api/reference/features/customer_profiles.html





Send feedback at developer_feedback@authorize.net

View solution in original post

8 REPLIES 8

Hi @ginocyber

 

Did  you tried  using the https://github.com/AuthorizeNet/sample-code-php  ?

 

https://github.com/AuthorizeNet/sample-code-php/blob/master/README.md

 

 





Send feedback at developer_feedback@authorize.net
Anurag
Moderator Moderator
Moderator

Hi Anurag,

 

using the sample code, I am now getting this error

 

Fatal error: Uncaught Error: Class 'SampleCode\Constants' not found in /home/k5bm176yktda/public_html/SampleCode/PaymentTransactions/charge-credit-card.php:135 Stack trace: #0 {main} thrown in /home/k5bm176yktda/public_html/SampleCode/PaymentTransactions/charge-credit-card.php on line 135

 

 

 You need to  include this file from Github "sample-code-php/constants/Constants.php", at the very top of your script (charge-credit-card.php for exemple), and it will work fine.

 

 





Send feedback at developer_feedback@authorize.net

Thanks you so much. That did it.

 

Last question -> When I pass the credit card # and the 3 digit security # to authorize, do I encrypt in md5 or send it as plain text.

 

 

Are you looking at PCI compliance when sending the credit card info ?

 

If so check Accept.js at https://developer.authorize.net/api/reference/features/accept.html 

 

Accept.js is a JavaScript-based solution for sending secure payment data directly to Authorize.Net. The Accept JavaScript library intercepts the payment data before it is passed to your server and instead submits it directly to Authorize.Net, which replaces it with a one-time-use token, or payment nonce. This payment nonce, which is returned by the JavaScript library, can be used in the place of payment data in any Authorize.Net API request.

 

https://developer.authorize.net/api/reference/features/acceptjs.html





Send feedback at developer_feedback@authorize.net

Thanks. I am working on a membership site where the first 3 months is free and then I will charge the member every month. This will be recurring until the member cancels their membership.

 

I run a cron job every night to see when the membership is expired and if so, I will send the credit card infor, billing information, and the amount to authorize.net.

 

So I will be storing the CC info in my DB and then sending it to authorize.net once it's time to renew the membership.

 

That said, md5 for the credit card # would be the way I should go, correct?

 

 

in your use case i will recommend to leverage our customer profiles features . 

 

You can call it to create the customer and payment profile for each member and then pass the paymentProfile ID for createTransaction when you want to charge . 

 

More details at https://developer.authorize.net/api/reference/features/customer_profiles.html





Send feedback at developer_feedback@authorize.net

Excellent, thank you very much