Process eWAY payment using on-site form (no redirect to eWAY).
Hi there,
I need to process an eWAY payment using a form on our website (it is not acceptable to redirect off to eWAY to process the payment). I have read Integrating with a Payment Gateway using External Payment Windows, which I believe is talking about how to do this, and it seems to say that I need to implement a RenderPage method, and call that instead of RequestPayment...
I looked in the source for the EWayPaymentMethodService, and this is the RenderPage method:
// UCommerce.Transactions.Payments.EWay.EWayPaymentMethodService publicoverridestringRenderPage(PaymentRequest paymentRequest)
{ thrownewNotSupportedException("EWay does not need a local form. Use RequestPayment instead.");
}
Similarly, when I look at AcquirePaymentInternal (which I believe I would need to call), it ominously shows:
// UCommerce.Transactions.Payments.EWay.EWayPaymentMethodService protectedoverrideboolAcquirePaymentInternal(Payment payment, outstring status)
{ thrownewNotImplementedException("Acquire not supported from EWay payment provider.");
}
What I want, is something similar to what is described in this article - Setup uCommerce to Include Braintree Payments as a Payment Method - which shows that you can call RenderPage as so: @Html.Raw(paymentWindow.RenderPage(new PaymentRequest(payment.PurchaseOrder, payment)))
Well, I called them, and they explained that Rapid 3.0 is the way to post data off to eWAY - but that doesn't help me with the uCommerce side of things. My question is, if eWAY supports it, why wasn't it implemented in the EWayPaymentMethodService (which says eWAY doesn't support it)? Do I have to write a whole new payment method service (not a simple task by the looks of things) just to add this kind of functionality? If so, are there any other resources available other than this article?
We did our eWAY integration before the new eWAY APIs were introduced so the default integration supports only what was supported back then.
All our default payment providers use the "hosted payment form" method for integration to reduce security requirements on your end, specifially avoiding PCI requiremnts for your server environment.
What this means is that you're looking at building your own payment method service to support RAPID 3.0 and payment form local on your store.
Fortunately doing the local payment form is a much simpler process than doing "hosted payment forms" so you really only need this information to do so: Integrating uCommerce with a Payment Provider
You really only require RequestPayment as everything is done in a synchronous manner when you're integrating with the RAPID APIs in this way.
You can add creditcard, cvc, expiration, etc. info to the payment request using the "AdditionalProperties" collection.
Here's what the client bit would look like:
// Get the amount to request var basket = SiteContext.Current.OrderContext.GetBasket().PurchaseOrder; var amountToRequest = new Money(basket.OrderTotal.Value, basket.BillingCurrency);
// Get the payment method and set up a new payment request var paymentMethod = PaymentMethod.SingleOrDefault(x => x.Name == "eWay Rapid"); var paymentRequest = new PaymentRequest(purchaseOrder, paymentMethod, amountToRequest);
// Get the service IPaymentMethodService ewayService = paymentMethod.GetPaymentMethodService();
// Request payment with eWAY Payment payment = ewayService.RequestPayment(paymentRequest);
// Check that it's OK var okPaymentStatus = PaymentStatus.Get((int)PaymentStatusCode.Authorized); bool ok = payment.PaymentStatus == okPaymentStatus;
Process eWAY payment using on-site form (no redirect to eWAY).
Hi there,
I need to process an eWAY payment using a form on our website (it is not acceptable to redirect off to eWAY to process the payment). I have read Integrating with a Payment Gateway using External Payment Windows, which I believe is talking about how to do this, and it seems to say that I need to implement a RenderPage method, and call that instead of RequestPayment...
I looked in the source for the EWayPaymentMethodService, and this is the RenderPage method:
// UCommerce.Transactions.Payments.EWay.EWayPaymentMethodService
public override string RenderPage(PaymentRequest paymentRequest)
{
throw new NotSupportedException("EWay does not need a local form. Use RequestPayment instead.");
}
Similarly, when I look at AcquirePaymentInternal (which I believe I would need to call), it ominously shows:
// UCommerce.Transactions.Payments.EWay.EWayPaymentMethodService
protected override bool AcquirePaymentInternal(Payment payment, out string status)
{
throw new NotImplementedException("Acquire not supported from EWay payment provider.");
}
What I want, is something similar to what is described in this article - Setup uCommerce to Include Braintree Payments as a Payment Method - which shows that you can call RenderPage as so: @Html.Raw(paymentWindow.RenderPage(new PaymentRequest(payment.PurchaseOrder, payment)))
So is this possible to do with eWAY?
Hi Daniel,
This is definitely possible using Rapid 3.0. If you call eWAY support on 1800 10 65 65, they can help you set it up.
Kind regards,
The eWAY Team
Hi Daniel,
Did you get it sorted with eWAY?
Well, I called them, and they explained that Rapid 3.0 is the way to post data off to eWAY - but that doesn't help me with the uCommerce side of things. My question is, if eWAY supports it, why wasn't it implemented in the EWayPaymentMethodService (which says eWAY doesn't support it)? Do I have to write a whole new payment method service (not a simple task by the looks of things) just to add this kind of functionality? If so, are there any other resources available other than this article?
Any help on this would be greatly appreciated. I think that the article I mentioned is not even relevant - so I have no idea where to go from here.
We did our eWAY integration before the new eWAY APIs were introduced so the default integration supports only what was supported back then.
All our default payment providers use the "hosted payment form" method for integration to reduce security requirements on your end, specifially avoiding PCI requiremnts for your server environment.
What this means is that you're looking at building your own payment method service to support RAPID 3.0 and payment form local on your store.
Fortunately doing the local payment form is a much simpler process than doing "hosted payment forms" so you really only need this information to do so: Integrating uCommerce with a Payment Provider
You really only require RequestPayment as everything is done in a synchronous manner when you're integrating with the RAPID APIs in this way.
You can add creditcard, cvc, expiration, etc. info to the payment request using the "AdditionalProperties" collection.
Here's what the client bit would look like:
Hope this helps.
Thanks Soren. That seems to make a lot more sense. Ill let you know how I go.
Hi Soren, I use eWay as a gateway. . I used the code above but i'v got an error only in this line:
Payment payment = ewayService.RequestPayment(paymentRequest);
the error is "Object reference not set to an instance of an object."
can you please help me on this.
Thank you.
Hi Ramon,
The code above is just an example. It requires a payment method to be set up called "eWAY Rapid".
If you want to set up the standard eWAY provider please take a look at the docs at Setting up eWAY Australia.
Hope this helps.
is working on a reply...