• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 460
  • Last Modified:

Form Processing Question after Credit Card Approval

I have a php (I think question) Here is the scenario.
I have an order form for my widget product. A customer orders 1 widget for $10. She complete the order form and on submit is taken to the payment information form where she completes the credit card information.
She complete all the credit card and customer information and hits submit, the form is sent (securly) to a file called PROCESSOR.PHP which lives on the payment processor server (I am using USAepay). During this processing time I want the user to see a message that says "We are processing your card". PROCESSOR.PHP  is doing all the work sending the credit card information  out for approval. If approved, PROCESSOR.PHP is still incontrol and  I have a redirect statement that sends the customer to a success/thankyou page. BUT at the same time I want to send myself an email telling me that so-and-so custome purchased 1 widget for $10 and include the customer information AND I want a custom email receipt sent to the customer. My gateway processor has an automatic confirmation but I would like it to to be more friendly. I have uploaded the processor.php file (without any secure information) to http://www.alexisjean.com/experts/processor.php
0
MarleneAyers
Asked:
MarleneAyers
  • 2
  • 2
  • 2
2 Solutions
 
RurneCommented:
Can you upload that again?  I'm getting a 404 trying to view it.
0
 
MarleneAyersAuthor Commented:
Sorry. I had made a copy and then fogot to rename. I am anxious to see your response.
0
 
MarleneAyersAuthor Commented:
I think I am better off just pasting the code here.
<?php
$tran=new umTransaction;
$tran->key="";
$tran->card=$_POST['xxx'];            // card number, no dashes, no spaces
$tran->exp=$_POST['xxxx'];                  // expiration date 4 digits no /
$tran->amount="1.00";                  // charge amount in dollars (no international support yet)
$tran->invoice="1234";               // invoice number.  must be unique.
$tran->cardholder=$_POST['xxxxxx'];       // name of card holder
$tran->street=$_POST['xxxxxx'];      // street address
$tran->zip=$_POST['xxxxxxx'];                  // zip code
$tran->description="Online Order";      // description of charge
$tran->cvv2=$_POST['xxxxxx'];                  // cvv2 code      
$tran->custemail=$_POST['custemail'];
$tran->custreceipt=true;
$tran->ignoresslcerterrors=false;
echo "<h1>Please Wait One Moment While We process your card.<br>\n";
flush();
if($tran->Process())
{
     $URL="approved.php";
          header ("Location: $URL");
else {
      $URL="declined.php";

      header ("Location: $URL");
      
      }

?>
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
MasonWolfCommented:
Ok, at first glance, I'd use the php mail() statement, and configure a different message to be sent depending on whether the transaction succeeded or not.

As for the "Please wait one moment..." message, is there something wrong with the way you have it now? I don't see any statement that you've started an output buffer. If it isn't working right now, then I would try:

ob_end_flush();
ob_start();
echo "<h1>Please Wait One Moment While We process your card.<br>\n";
ob_flush();
flush();

You've explained what you want to happen, but you haven't said explicitly what errors you're seeing, so I'm not sure if this is actually the solution that you need.
0
 
RurneCommented:
I would dare venture that if you're seeing errors, it's due to headers already being sent.  To wit, the echo statement begins HTML mode, and the ()flush pushes a full set of HTTP headers for the GET request.  You shouldn't be able send a Location: header after that, since you've already sent headers and are in the middle of delivering the body for the request.

But yes, you can use mail() to handle sending custom emails.
0
 
MasonWolfCommented:
That's a very good point about trying to send a location header. Use javascript to redirect the browser instead:

echo "<script type='text/javascript'>location.href='$URL';</script>";
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now