Starting point for Payment Provider

Discussion area for and about AbleCommerce hosting and development providers. If you provide AbleCommerce services let our users know.
Post Reply
bnsc
Ensign (ENS)
Ensign (ENS)
Posts: 2
Joined: Mon Oct 19, 2009 9:47 am

Starting point for Payment Provider

Post by bnsc » Mon Sep 20, 2010 4:18 pm

I am looking for the starting point in the code for the process of developing a payment gateway. I have the code set up and I can get the payment gateway to show up in the list on the ablecommerce site, but I do not have the special knowledge that will push me over the top to get the payment gateway to work. This particular payment gateway is for Touchnet UPay. I work for Texas A&M University and this is the gatway system authorized for use by the university. It basically requires a button to show up on the checkout page so the user can then click the button and be taken to the secure payment page of the UPay system. I am looking at the PayPal payment gateway code and I cannot seem to identify what calls the code that displays the button. If you think you can help, let me know. I can post the source if you like.

I did ask for support from ablecommerce and they said this is a development effort and that posting on this forum would be the only way to get an answer.

My real need is a bit of insight into the flow of the code. I don't need tons of dev help. just a kick in the right direction.

Thank you in advance for your help.

Best Regards,

Bill Cochran

plugables
Captain (CAPT)
Captain (CAPT)
Posts: 276
Joined: Sat Aug 15, 2009 4:04 am
Contact:

Re: Starting point for Payment Provider

Post by plugables » Tue Sep 21, 2010 10:42 am

Here is all you should need to get direct API payment gateways implemented for AbleCommerce.
http://wiki.ablecommerce.com/index.php/ ... nt_Gateway

If your payment gateway does not support direct API, i.e; it requires you to go to their site to make the payment then the integration will be a bit more difficult to achieve... and it seems you are doing such an integration.
For button to show at checkout page you will have to customize the checkout page as well. Payment gateway code alone won't work. If your gateway sends instant call-back notifications you will need to write a handler to handle the call-back notifications.

bnsc
Ensign (ENS)
Ensign (ENS)
Posts: 2
Joined: Mon Oct 19, 2009 9:47 am

Re: Starting point for Payment Provider

Post by bnsc » Tue Sep 21, 2010 2:40 pm

Thanks for the tip. I looked at that page many times. I do seem to be doing the difficult route (which to me seems the easy way, but that's my novice ignorance). I would be satisfied to be able to display the checkout button with the proper post form so I could start sending payments to the gateway. I will handle the return information manually if needed. Obviously, i would prefer to receive the information directly, but that may be a stretch.

I started by making a copy of the paypal gateway, but i scrapped that and built my own from empty code page. This seems to be ok, but I cannot for the life of me figure out what the stream of code that handles the excution of the payment gateway. I can trace code and I have all of the resources at my finger tips, so I'm going to dive into this again. if you think you have an idea on where i should devote my attention, please send it.

Thanks for your help.

Bill

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Starting point for Payment Provider

Post by mazhar » Sat Sep 25, 2010 7:51 am

EDIT MADE

Hi Bill, as you mentioned It seems that you are looking to redirect customer to Touchnet UPay upon order completion. In such scenarios normally you redirect the customer to third party website with some information that's been required by third party website(provider) and then after processing it callbacks some configured page in your website telling about actions taken by third party provider on your payments.

There could be different approaches when it comes to sending payment information to third party websites for payments. Normally simple HTML form post with hidden fields containing required data are used for this purpose. This is what we are having in our PayPal PayNow button. The source code of this button is in back end API codes. If you have back end source code then can see the code of button in Providers/PayPal/PayNowButton.cs.

Payment integrations that involves redirection to third party are actually a little bit different from normal AbleCommerce Payment Gateway integrations as described in http://wiki.ablecommerce.com/index.php/ ... nt_Gateway. Actually in case of redirection all you need is to redirect customer to third party and then listen on your callback URL for notifications sent by third party to adjust your payment records accordingly. So all you need is to create a user control in Website\Checkout\PaymentForms folder. A handler to do the redirection and to post the desired data to third party. Then adjust the one page checkout to take care of a new payment method form. Look into ConLib/OnePageCheckout.ascx.cs file and locate how its adding payment method forms to page. You simply add yours in default case of switch statements. Then Go to your admin panel and add one payment method name it what ever you want just don't specify any gateway and type for it. Now when you will try to checkout you will see the option for you custom method with your new payment form.

See the attached sample. You will be required to correct redirect URL and put actual parameters that you need to send to third party upon redirect in RdirectHandler.ashx code file.

joea84
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 27
Joined: Wed May 26, 2010 11:55 am

Re: Starting point for Payment Provider

Post by joea84 » Fri Oct 15, 2010 4:19 pm

Hi,

I'm also trying to integrate TouchNET. I put the code in OnePageCheckout.cs here:

default:
ASP.RedirectForPayment registerForm = new ASP.RedirectForPayment();
registerForm.PaymentMethodId = selectedMethod.PaymentMethodId;
registerForm.CheckingOut += new CheckingOutEventHandler(CheckingOut);
registerForm.CheckedOut += new CheckedOutEventHandler(CheckedOut);
registerForm.ValidationGroup = "OPC";
registerForm.ValidationSummaryVisible = false;
phPaymentForms.Controls.Add(registerForm);


break;

It works fine on 7.0.4, but not on 7.0.3. Am I missing something? When that code was placed here:

case PaymentInstrument.PurchaseOrder:
ASP.RedirectForPayment registerForm = new ASP.RedirectForPayment();
registerForm.PaymentMethodId = selectedMethod.PaymentMethodId;
registerForm.CheckingOut += new CheckingOutEventHandler(CheckingOut);
registerForm.CheckedOut += new CheckedOutEventHandler(CheckedOut);
registerForm.ValidationGroup = "OPC";
registerForm.ValidationSummaryVisible = false;
phPaymentForms.Controls.Add(registerForm);

The user control appeared, when the customer clicks PO as shown in the image. It appears that AbleCommerce doesn't know that the TouchNET selection in the radio box should bring up the TouchNET control.

Image

I had a workaround where I assigned the AbleCommerce test gateway to it and it worked. So, I used this code and I think there is an issue:

case PaymentInstrument.PhoneCall:
paymentMethods.Add(new DictionaryEntry(method.PaymentMethodId, method.Name));
break;
default:
//types not supported

paymentMethods.Add(new DictionaryEntry(method.PaymentGatewayId, method.Name));
break;

When I used method.PaymentMethodId instead of the GatewayId, the control is invisible.

shanzaymalik
Ensign (ENS)
Ensign (ENS)
Posts: 1
Joined: Fri Jan 28, 2011 7:39 am

Re: Starting point for Payment Provider

Post by shanzaymalik » Fri Jan 28, 2011 8:07 am

thanks plugables, your posted link is very helpful and useful for me,
here are nice tips thanks
http://www.pakhot.com

Post Reply