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?
Solved! Go to Solution.
โ05-26-2018 10:31 AM
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.
โ05-26-2018 01:41 PM
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
โ05-28-2018 11:56 PM
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
โ05-26-2018 12:11 PM
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
โ05-26-2018 01:14 PM
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.
โ05-26-2018 01:41 PM
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.
โ05-26-2018 02:22 PM
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
โ05-27-2018 12:47 AM
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?
โ05-27-2018 09:35 AM
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
โ05-28-2018 11:56 PM
Excellent, thank you very much
โ05-29-2018 05:31 AM