Showing results for 
Search instead for 
Did you mean: 

Posting to Authorize.Net Simple Checkout using PHP curl

I have a client who uses Simple Checkout. He wants to do something a little fancier, though. He has a menu of six different items, and instead of displaying six different checkout buttons, I want to have the customer select the item from a menu, then use curl to send them to the appropriate Authorize.Net checkout form.


So, I wrote the following:



if ($_POST['Pay_By'] == 'CC') {

switch ($_POST['Pay_Type']) {

case "option 1":

$linkId = 'LinkId=1';


case "option 2":

$linkId = 'LinkId=2';


case "option 3":

$linkId = 'LinkId=3';


case "option 4":

$linkId = 'LinkId=4';


case "option 5":

$linkId = 'LinkId=5';


case "option 6":

$linkId = 'LinkId=6';



//send with cURL

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, '');

curl_setopt($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_HEADER, 0);

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);

curl_setopt($ch, CURLOPT_POSTFIELDS, $linkId);

$content = curl_exec($ch);


else header("Location:");



The LinkIds were the correct link ids from the Simple Checkout forms.


Unfortunately, this doesn't work. It looks like the information gets posted, but Authorize.Net never displays the checkout form. I posted this information to another URL, and it looks to me as though the curl() code is working properly. So, why does seemingly not want to accept my posts?


would that be easier if you have a ddl of with the text as the product, value witht the linkid value and the control name as the "linkid"


<select name="linkId" >
  <option value="1">option 1</option>
  <option value="2>option 2</option>
  <option value="3">option 3</option>
  <option value="4">option 4</option>

The problem that you are going to have with curl is that it is a server-to-server connection method, meaning that the form is being posted from your server to Authorize.Net. When you use the normal form that is a part of our simple checkout code, the post comes from the customer's web browser to Authorize.Net and that is how we are able to initiate the pop-up.


You may be able to accomplish similar result using javascript or the something like Raynor suggested, but I would just add the disclaimer that we only officially support our simple checkout buttons if the code is unmodified from what we provide. That is not to say that you cannot build something like you are describing, it just means that there is at least a small chance that a future update from us might break it because it is a scenario that we are not testing for.

Administrator Administrator

Hmmmmm. That's kind of disappointing. 


I can't really use the dropdown as Raynor suggests, because the client is also gathering user information, so I can' t just post directly from a form. This wouldn't be a problem if you didn't implement this as a pop-up. 


The solution was to implement an intermediate page that displays the appropriate Pay Now button. That's a pretty klunky solution, though. :(

Maybe DPM/SIM with relay response  which can relay merchant define fields. or if your client have SSL use AIM.