Jump to content

Developing a custom payment module


tandlit

Recommended Posts

Hi everyone,

 

I have written a custom payment module to accept payment from a local bank here in Australia. I am using the bank's hosted payment solution, so the customer is redirected away from the prestashop store.

 

The thing I'm unclear about is how to communicate to prestashop that successful payment has been made. I am assuming the bank will send the information back through a web request or possibly the query string but I don't know which php file in prestashop to direct it to.

 

Any help would be greatly appreciated.

 

Many thanks,

 

Tas

Link to comment
Share on other sites

Hi you,

 

Most of the time you indicate the validation url to the bank in their web administration for the account. Let's call this url 'server to server' only known by you and by your bank.

 

This one will be different from the one that allow the customer to go back to your site after payement.

 

Best thing to do for module payment is to study working ones like sips Atos for example (do you have this one in australia ?)

 

Regards

Link to comment
Share on other sites

Hi you, Most of the time you indicate the validation url to the bank in their web administration for the account. Let's call this url 'server to server' only known by you and by your bank. This one will be different from the one that allow the customer to go back to your site after payement. Best thing to do for module payment is to study working ones like sips Atos for example (do you have this one in australia ?) Regards

 

Thanks for your reply.

 

If I have understood correctly, I will tell the bank where to send the message confirming successful payment. When I receive that message, I'd like to update the order in prestashop and mark it as paid. This is where I come unstuck. I have no idea how to do that in code. Does the paypal module use IPN to do this? If so, I think that may be the answer to my question.

 

I suppose the shop owner can always mark off the payment manually in the back office. I just thought it would be nicer to automate it.

 

Tas

Link to comment
Share on other sites

Ther will be two files, one for the bank response, and one for the customer response.

The first one chaces the transaction id, that will be stored in your bdd as "pre_paidment", and if this id is in this bdd, and the return code is OK, you will transform this "pre_paidment" to "order", then at the same time, the customer will have a tpl if this all ok, or an other if there is a problem.

 

If you want, you can check this module: http://www.prestashop.com/forums/topic/89234-modulo-lacaixa-yago-ferrer-version-11-gratis-y-testeada/

Is form a spanish bank, and it works as I said.

 

Hope it helps!

Link to comment
Share on other sites

usually you create a validation.php file that would be provided to the merchant (either through their API, or in the merchant account).

The validation.php would verify the payment authorization, and then execute validateOrder function, and redirect to order confirmation page.

 

look at the authorizeaim module that is packaged with prestashop for an idea.

Link to comment
Share on other sites

  • 1 month later...

help me...

 

i want to customize my payment method, where i need to submit form which includes id_order, etc to other sites and i want it happen after i click the i confirm my order but i cant find where can i get the id_order and display it to Order Summary...

Link to comment
Share on other sites

Hi bellini13! Thank you for your response...

 

Is this the code?

Mail::Send((int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, $fileAttachment);

 

I found it at the end of public_function_validateOrder and i comment out like this

//Mail::Send((int)$order->id_lang, 'order_conf', Mail::l('Order confirmation', (int)$order->id_lang), $data, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, $fileAttachment);

 

sorry, i am a beginner... :lol:

 

I try this but it was an error then i also comment out the:

//if (Validate::isEmail($customer->email)) found at the top of Mail::Send...

It shows no more error..

Is this correct?

Edited by kelvz (see edit history)
Link to comment
Share on other sites

Hi!

I want to update the order status of orders to "Payment Accepted" and generate invoice of it.

 

The question is how to make it automatically without using admin.

Because my payment module automatically transact to the bank and the bank will require to fill up credit card information then when the credit card is accepted , the bank will sent you a successful text and i want it happen in that page.

 

sorry for my english... ^_^

Link to comment
Share on other sites

  • 6 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...