Reply
Highlighted
Member
Posts: 2
Registered: ‎03-19-2012

DPM Issue - Sample Code - URGENT!!

Hello.

 

Am using PHP to integrate DPM in a website for my client.

 

Essentially, the client has a registration form for a camp. They give the site visitor the option of paying by check via mail or by credit/debit card via Authorize.net.

 

There is only one registration form (a simple HTML form with some required fields such as name, which camp session, etc.). One field is a set of radio buttons for choosing payment type. The intention is that, when the "pay by credit/debit card" option is chosen and the user submits the form, the user gets sent to a form to pay using Authorize.net. (For those interested, choosing the "pay by check" option simply takes the user to a printable version of the form that the user can print and mail back to my client for processing.)

 

Also, either method of payment results in an email of the registration information sent to both the user and the site admin (my client).

 

The PHP for processing the form information and sending out the necessary emails is in place and working as expected.

 

The only issue I have is how to integrate this with Authorize.net.

 

After reading the API options, I settled on Direct Post Method (DPM). The testing seemed to go OK with the 15 minute sample. But, when I try to use the sample described in the online documentation for PHP (the one with the 3 files: checkout_form.php, relay_response,php and order_receipt.php), the same error seems to occur consistently.

 

First, I can only get the checkout_form.php to display the Authorize.net payment form when the file is in the root of the website. It would be best for the site if this could be placed in a folder/directory deeper in the site. (My testing with checkout_form.php at a deeper level in the site displays literally nothing in the browser. And, I've tried several browsers from FireFox to Safari to Internet Explorer.)

 

Next, when I submit the checkout_form.php, it gives the following error:

 

"An error occurred while trying to report this transaction to the merchant. An e-mail has been sent to the merchant informing them of the error. The following is the result of the attempt to charge your credit card.

 

This transaction has been approved.

 

It is advisable for you to contact the merchant to verify that you will receive the product or service."

 

This error is shown apparently from test.Authorize.net instead of the relay_response.php or order_receipt.php from my client's site. And, when I check the test account, the transaction does show as "unsettled" in the Transaction Report, which is expected. What is causing this error?

 

Also, the checkout_form.php seems to show a pre-filled form. How does that data get in there? How could I use this to show a blank payment form for my client's prospective camper to fill out? Any suggestions?

 

Lastly, I am using a test account on Authorize.net for testing until I am given the proper Login ID and Transaction Key from my client. Does this affect anything?

 

I'm not a newbie to PHP or HTML. But, I am a newbie to Authorize.net integration. Any detailed help would be greatly appreciated!!

 

(I am on a deadline on this and need a solution to this as immediately as possible.)

Highlighted
Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: DPM Issue - Sample Code - URGENT!!

Did you set the relay response URL in your control panel? If not, the relay response page will be ignored, like what you're describing. As for the checkout form, you're probably using the default function. Go to the lib folder of your SDK and look for the file AuthorizeNetDPM.php. Inside that will be a function getCreditCardForm. Just copy that code and modify it for your needs, rather than calling the function.

Highlighted
Member
Posts: 2
Registered: ‎03-19-2012

Re: DPM Issue - Sample Code - URGENT!!

Thank you for the quick reply.

 

When looking at the function, I noticed that their are 2 parameters not shown in the sample files: one for using test mode and one for prefilling the form. Using these helped me control the form a lot more.

 

Next up, to look into what is causing the error message to come up.

 

The error message described in the initial post is still showing up. Is it because of something in the function? Or, is it something coded in the gateway itself? Or, does it involve issues with the Relay Response and/or Receipt URL settings in the Authorize.net account?

 

This is still quite urgent!

 

More help would be greatly appreciated!!

Highlighted
Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: DPM Issue - Sample Code - URGENT!!

It could be that your relay response setting is incorrect. Could also be that Authorize.net can't contact your relay response page, for a number of possible reasons:

http://community.developer.authorize.net/t5/The-Authorize-Net-Developer-Blog/Relay-Response-Basics-a...