Showing results for 
Search instead for 
Did you mean: 

Can't get DPM to work

I have tried the SIM method an have gotten it to work. Now I am trying the DPM and I can not get it to work for me.


I am testing with the Coffee store example and have followed all the instructions and configured the config,php.

When I get to the checkout_form.php and press Buy I get this message:

3,2,13,The merchant login ID or password is invalid or the account is inactive.,,P,0,,,2.18,,auth_capture,,,,,,,,,,,,,,,,,,,,,,,,,,9F76D49A5960CCB8226C471FBB9C8277,,,,,,,,,,,,,,Bank Account,,,,,,,,,,,,,,,,


I know my login ID and password are correct because I used them in the SIM method.


Please help - Sam


I don't know what else to change.

Can you post the browser page source when you are on the checkout_form.php page?

This is exactly my problem as well. I get a similar error message. I have a payment page on our site with a form. That form has its action set to my version of checkout_form.php with my custom fields added. When I run it the John Doe test page appears and if I click Buy I get the following error:


3,2,13,The merchant login ID or password is invalid or the account is inactive.,,P,0,,,0.00,,auth_capture,,,,,,,,,,,,,,,,,,,,,,,,,,F68A9C87C1E1472521704EF38C21F647,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,


As must be apparent this is all new to me. I am also very eager to solve this dilemma. Thanks in advance for any help you can give.





Just flinging this out, would this code work on a custom checkout_form page?


$api_login_id = 'xxxxxxx'; // API Login
$transaction_key = 'xxxxxxxxx'; // Transaction key
echo '<form action="" method="post">';
echo '<p>Name: <input type="text" size="20" name="name" /></p>';
echo '<p>Item: <input type="text" size="20" name="name" /></p>';
echo '<p>Amount: <input type="text" size="20" name="name" /></p>';
echo '</form>';


Delete the post with your LoginID and TransactionKey. Never ever show it. Better yet, regen the TransactionKey.


Look at for the list of fields to send. And post to the site for you production implementation.

FYI, I keep telling people this, but apparently it's a well-kept secret - you can output code in blocks instead of using a million print statements.


print <<<BLOCK
<form action="" method="post">
<p>Name: <input type="text" size="20" name="name" /></p>
<p>Item: <input type="text" size="20" name="name" /></p>
<p>Amount: <input type="text" size="20" name="name" /></p>

Also, I'm not sure what you were trying to do there, but it clearly isn't going to work. Even as a form, since you named all the fields the same thing. Look at the DPM code sample, and also go into your SDK in the lib folder and open the file AuthorizeNetDPM.php. There's a function in there called getCreditCardForm() which will show you more the sort of thing you need to be displaying.

Yes, studid damned me! Thank you for pointing out the obvious folly. I sure wish my brain had done so first.

Okay, I am both stupid and tweaked, a perilous combination to say the least. Let's set it right. I want to know if this is the kind of stucture I need to make the DPM option work using a custom made form. Just want to ask if this code is going in the right direction. Thanks!


$api_login_id = 'xxxxxxx'; // API Login
$transaction_key = 'xxxxxxx'; // Transaction key
echo '<form action="" method="post">';
echo '<p>Name: <input type="text" size="20" name="name" /></p>';
echo '<p>Item: <input type="text" size="20" name="item" /></p>';
echo '<p>Amount: <input type="text" size="20" name="amount" /></p>';
echo '<button type="submit">Submit</button>';
echo '</form>';


If you want to generate the entire form yourself, you're missing the credit card fields. DPM involves having the form on your site, but submitting it to a secure URL, so the data never actually goes through your server. As I said before, look in the PHP SDK, in the folder called lib, for a file called AuthorizeNetDPM.php. Look about halfway through and you'll see a function called getCreditCardForm. This is more like the HTML you should be using. If you just want to implement and move on, the code sample supplied by says:


require_once 'anet_php_sdk/AuthorizeNet.php'; // The SDK
$url = "";
$api_login_id = 'YOUR_API_LOGIN_ID';
$transaction_key = 'YOUR_TRANSACTION_KEY';
$md5_setting = 'YOUR_API_LOGIN_ID'; // Your MD5 Setting
$amount = "5.99";
AuthorizeNetDPM::directPostDemo($url, $api_login_id, $transaction_key, $amount, $md5_setting);

This calls directPostDemo(), which in turn calls getCreditCardForm(), which as I said is a good example of where to start. I'm afraid that while I'm fairly good with PHP and HTML, I haven't implemented DPM myself yet, so I can't just paste you three chunks of code and tell you to copy me - you have to be willing to do some digging and work it out yourself.

Since the API Login and Transaction Key can only be processed unseen the only way to do it would seem to be like this:


<form name="payments" action="checkout_form.php" method="post">
<p>Payer Name: <input type="text" size="20" name="name" /></p>
<p>Email: <input type="text" name="email" size="20" /></p>
<p>Phone: <input type="text" name="phone" size="20" /></p>
<p>Payment Description:<br />
<textarea cols="18" rows="3" name="desc"></textarea></p>
<p>Amount: <input type="text" name="amount" size="20" /></p>
<button type="submit">Make Payment</button>

 Create a custom form with action="checkout_form.php"and then do this:


<?php require_once 'php/anet_php_sdk/AuthorizeNet.php'; // The SDK
$relay_response_url = ""; 

$api_login_id = 'xxxxxx'; // API Login
$transaction_key = 'xxxxxx'; // Transaction key

// Custom fields
$payer = $_POST["pfirst"]." ".$_POST["plast"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$description = $_POST["desc"];
$amount = $_POST["amount"];

// Add custom field variables to array
echo AuthorizeNetDPM::getCreditCardForm($payer, $camper, $email, $phone, $description, $amount, $relay_response_url,$api_login_id, $transaction_key); ?>

 Edit checkout_form.php to include the custom fields. Sensible, no? But when you try to do it it returns the Test example because the whole thing seems set up to use AuthorizeNetDPM.php which appears to have been designed as a demo. Is there another version of this file that only does LIVE processing?


More to follow...

I don't know how this thing is supposed to work, but I think I have a simple way to make it work, as in 1, 2, 3, 4, bingo!


  1. Download file templates for checkout_form.php, relay_response.php and order_receipt.php
  2. Make a custom shopping cart page with its action set to checkout_form.php.
  3. Edit checkout_form.php, adding to it API Number and Transaction Key along with all the custom field names. Make all required edits in the other two files to make them functional.
  4. Go to your Account Center @ and set up a Payment Receipt page that will include all the custom fields you will be sending.

And that's it. What do you think?