Jump to content

jussc

New Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by jussc

  1. It worked! Thank you to the both of you for helping me out on this. I really appreciate this.
  2. here is the function prepareForm function prepareForm(){ $('#submitPayment').val('Please wait ...'); var processPayment = $.ajax({ type: 'POST', url: "test.php", data: {"amount": $('#x_my_amount').val()}, dataType: 'json', async: false, success: function(data) { $('#x_login').val(data.login); $('#x_amount').val(data.amount); $('#x_fp_sequence').val(data.sequence); $('#x_fp_timestamp').val(data.timestamp); $('#x_fp_hash').val(data.hash); $('#x_currency_code').val(data.currency); if(data.hash){ makeProcessed(true); } } }); return processed; }; i am so glad you can explain this to me in plain english i really appreciate it. so would the trick be to input in the fields that i have in the HTML as modeled in the function above? thanks
  3. Thanks for the response so far! This is the HTML. This is why I am confused - I am not sure whether it is possible because the target is the payment page... <form action="https://rpm.demo.e-xact.com/payment" method="POST" id="payment" onsubmit="return prepareForm();"> <input type="hidden" name="x_show_form" value="PAYMENT_FORM"/> <input type="hidden" name="x_test_request" value="FALSE"/> <input name="x_login" id="x_login" type="hidden" value=""> <input name="x_amount" id="x_amount" type="hidden" value=""> <input name="x_fp_sequence" id="x_fp_sequence" type="hidden" value=""> <input name="x_fp_timestamp" id="x_fp_timestamp" type="hidden" value=""> <input name="x_fp_hash" id="x_fp_hash" type="hidden" value="" size="50"> <input name="x_currency_code" id="x_currency_code" type="hidden" value=""> <div class="form-group"> <label for="company">Company Name:</label> <input type="text" class="form-control input-lg half" name="company" placeholder=""> </div> <div class="form-group"> <label for="invoice">Invoice #:</label> <input type="text" class="form-control input-lg half" name="invoice" placeholder="A12345"> </div> <div class="form-group"> <label for="amount">Amount:</label> <input type="text" class="form-control input-lg half" name="x_my_amount" placeholder="123.45" id="x_my_amount"> </div> <input type="submit" class="btn btn-default" name="submit" id="submitPayment" value="Pay with Hosted Checkout" /> </form>
  4. <?php if(isset($_POST['amount'])) { $company = $_POST["company"]; $invoice = $_POST["invoice"]; $subject = "New Payment"; $recipient = "[email protected]"; $message = "Message from $company with Invoice # $invoice"; mail($recipient, $subject, $message); // *********** Payment $x_amount = $_POST['amount']; $x_login = "don't post sensitive information"; // Take from Payment Page ID in Payment Pages interface $transaction_key = "on a public forum"; // Take from Payment Pages configuration interface $x_currency_code = "CAD"; // Needs to agree with the currency of the payment page srand(time()); // initialize random generator for x_fp_sequence $x_fp_sequence = rand(1000, 100000) + 123456; $x_fp_timestamp = time(); // needs to be in UTC. Make sure webserver produces UTC // The values that contribute to x_fp_hash $hmac_data = $x_login . "^" . $x_fp_sequence . "^" . $x_fp_timestamp . "^" . $x_amount . "^" . $x_currency_code; $x_fp_hash = hash_hmac('MD5', $hmac_data, $transaction_key); $values = array('login' => $x_login, 'amount' => $x_amount, 'sequence' => $x_fp_sequence, 'timestamp' => $x_fp_timestamp, 'hash' => $x_fp_hash, 'currency' => $x_currency_code, 'company' => $company); echo json_encode($values); die; } ?> Hello, I am having a bit of trouble in setting up a payment page. I am trying to do two things here. The form has three fields - Company, Invoice, and Amount. When the submit button is clicked, the action should take me to a payment page. This part works great. However, I am trying to _POST the other two fields - Company and Invoice - so I can have this information emailed to myself once the client clicks "pay". RIght now, when the button is clicked, it sends me to the payment page (good), and then the email also gets sent (which is also good). However, the email message doesn't work - it only shows the text without the variables. Like: Message from with Invoice # Without either variable posting through Is something like this possible? Or am I doing it completely wrong? Any help would be appreciated! Justin
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.