Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Credit Card Payment Module


dstu

Recommended Posts

Hello,

 

I work with my bank's credit card company. The process is the following:

1. The customer chooses to make a payment through credit card.

2. He is redirected to the bank's payment page by the module that I customized.

3. The bank returns to a ccback.php page that I created with a POST of relevant data. The most important fields are:

$ResponseCode - 1 means that the autorization was succesful

$AuthCode - the 6 digits code that proves that the transaction was authorized by the client's bank

$PaddedCardNo - the credit card number in the format xxxx-xxxx-xxxx-ABCD

$ReferenceNo - A reference number that I need to use to make the actual debit on the card, once I'm ready to ship the products().

 

4. I want to send an email to the client telling him that the credit card was authorized and that his card will be debited when the product will be shipped.

5. I need to update the order information to include the fields above (no need for the $ResponseCode).

 

I took some code from the cc.php payment module and tried to customize it to do what I need, but it's not complete and I'm not sure that it will work:

 

$next_page = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');

 

// Update order info and send the customer an email

$order->info['cc_number'] = $PaddedCardNo;

$order->info['cc_type'] = $AuthCode;

$order->info['cc_owner'] = $ReferenceNo;

 

$message = 'Dear' . '??? - Customer name' . "\n\n" .

'We received your Credit Card Debit Authorization.' . "\n\n" .

'Order #' . $insert_id . "\n\n" .

'Credit Card number: ' . $PaddedCardNo . "\n\n" .

'Your credit card will be debited upon delivery of your product.' . "\n\n";

// tep_email function fields are: ($to_name, $to_email_address, $email_subject, $email_text, $from_email_name, $from_email_address)

tep_mail('??? - Customer name', '??? - Customer Email Address', 'Credit Card Authorized. Order #:' . $insert_id, $message, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

// End update and email

 

tep_redirect($next_page);

exit;

 

In order not to start making changes in the database, I planned on using the existing cc related fields to store the data that I need, but I'm not sure that what I did will work.

 

Also, as you can see in the code, I don't know how to include the customer's details, such as his full name and email address in the email and if the database will be updated with the relevant information.

 

In case I'll need to move this code (in case it shouldn't be here) to the before_process or after_process functions of the payment module, how can I pass on the fields that I get from the cc company?

 

What is the difference between the 2 functions before_process and after_process in the payment module? What is considered the "process" before or after which these functions are used?

 

Thank you in advance for your help.

 

David

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...