Passing local currency amounts to Payment Gateway and report

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
niall08
Commander (CMDR)
Commander (CMDR)
Posts: 175
Joined: Tue Dec 09, 2008 10:29 am

Passing local currency amounts to Payment Gateway and report

Post by niall08 » Fri Apr 24, 2009 2:08 am

This is a follow on from an earlier post (viewtopic.php?f=42&t=10123).

I understand the need to create new Payment Gateways for handling payment in different currencies.

But how do you pass the local currency and local currency amount to the Payment Gateway - and record this amount in such a way that your admin reporting (i.e. Manage > Orders, and Invoices) show this payment in the currency and for the exact amount that the user paid?

I'm working in CreditCardPaymentForm.ascx - is this the right place to make these amends?

Do I need to save the payment.amount as the local currency amount - and maybe save the order amount in this local currency too, so that the reporting will tally with the Payment Gateway payment report?

niall08
Commander (CMDR)
Commander (CMDR)
Posts: 175
Joined: Tue Dec 09, 2008 10:29 am

Re: Passing local currency amounts to Payment Gateway and report

Post by niall08 » Fri Apr 24, 2009 8:47 am

Anyone have any idea on this one?

I saw the related thread about the multiple gateways on this one - but, if tying in the reporting functions can't be done, it doesn't really make sense to go to all that trouble for taking payments in foreign currencies..

Carolharry
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Wed Dec 17, 2008 9:13 am

Re: Passing local currency amounts to Payment Gateway and report

Post by Carolharry » Mon Apr 27, 2009 6:47 pm

Hi,

What payment gateway are you using?

We use pay flow pro which support multiple currencies. This means we subscribed for GBP payment gateway account with pay flow pro. So reading the IP address we determine the users local currency and assign it to their local gateway. (CreditCardPaymentForm.ascx is the right file where I assigned payment gateway dynamically.).

This is the line added in GetPayment method in Creditcardpaymentform.ascx

Payment payment = new Payment();
payment.PaymentMethodId = AlwaysConvert.ToInt(CardType.SelectedValue);
payment.PaymentMethod.PaymentGatewayId = 5(change this gateway id dynamically);
(Note: We don't give user to change his currency. We automatically assign it depending on his location)
AC will store the transaction details and amount in the store currency. We need to customize and come up with tables to store information about user currency amount etc to generate what ever reports we need to generate.

Having multiple gateways is because we don't want the customer to be charged with conversion fee rate from their local currency to our store currency. (we support only few gateways where we have greater number of customers with currencies other than our store currency.)

Hope this helps.

Thanks

niall08
Commander (CMDR)
Commander (CMDR)
Posts: 175
Joined: Tue Dec 09, 2008 10:29 am

Re: Passing local currency amounts to Payment Gateway and report

Post by niall08 » Tue Apr 28, 2009 1:06 am

Thanks So much for reply - it's great to get some movement on this..

We're using RealEx for the Payment Gateway - and yes, they support multiple currencies.

While playing around with the code in the credit card payment control, I noticed that AC didn't store the User's Currency type in the payments table of the database, and that the amount was always passed as the default currency of the store. A few amendments and the currency type and payment amount were as the user sees on-screen, all stored in the payments table of the AC database, and passed to the Payment Gateway.

I might also store the conversion rate in a join table.

Would you agree with this rationale so far?

I did notice, however, in the administration-side reports (e.g. Manage > Orders - and payments etc under this) that the reports were slightly awry - maybe they used the order total (which would be in the Store's primary currency) and the payment reflected the user's payment amount (as converted to their currency type) - so there was a discrepency (apparently) in the order total compared to the payment amount.

Did you notice that? If so, how did you overcome it?

Thanks for any guidance.

Carolharry
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Wed Dec 17, 2008 9:13 am

Re: Passing local currency amounts to Payment Gateway and report

Post by Carolharry » Tue Apr 28, 2009 8:56 am

I don't see any change in totals in orders and payments table. Everything is stored in store dollar equivalent amount.
I am using 7.02 version of AC.
Please post a screen short if possible where you find change in totals.

Thank you.

niall08
Commander (CMDR)
Commander (CMDR)
Posts: 175
Joined: Tue Dec 09, 2008 10:29 am

Re: Passing local currency amounts to Payment Gateway and report

Post by niall08 » Tue Apr 28, 2009 9:38 am

Maybe I've got the wrong end of the stick..

In CreditCardPaymentForm.ascx I explicitly set the payment.User.UserCurrencyID to the user's selected currency, and set the payment.amount to the total of the user's payment in that currency type, saving the payment object and passing the details to the payment gateway.

So in the AC database, the payment is recorded as (for arguments sake) 100 Euros - while the site primary currency is in Pounds Sterling (where the payment would be 90 Pounds.

Is that right?

Carolharry
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Wed Dec 17, 2008 9:13 am

Re: Passing local currency amounts to Payment Gateway and report

Post by Carolharry » Tue Apr 28, 2009 10:41 am

No I just assigned local payment gateway Id and I didn't change anything for the amount value. AC will take over to charge right amount.

Say you have a product X--100$

A person with GBP will view the product price as 100$ * GBP currency rate.(bcz we dynamically assign user currency ID)

During checkout we assing GBP gateway ID. The transaction is processed and in the order total 100$ is stored and not 100$*GBP currency rate.

If you check the logs in APP_Data folder payment log file I think you can see the transaction details going through GBP gateway if you assigned it right.

I cannot confirm you the change for the payment amount you have made(100Euros) is being stored in the payment table.

niall08
Commander (CMDR)
Commander (CMDR)
Posts: 175
Joined: Tue Dec 09, 2008 10:29 am

Re: Passing local currency amounts to Payment Gateway and report

Post by niall08 » Tue Apr 28, 2009 1:48 pm

So what is passed to the new Payment Gateway.. $100 or the equivalent in GBP?

At present, no currency type is being passed to the gateway, and the total being paid is in the primary currency. As far as I can see, I'd have to do something like this:

Code: Select all

String strCurrencyCode = Token.Instance.User.UserCurrency.ISOCode.ToString();
Payment payment = new Payment();
 payment.PaymentMethodId = AlwaysConvert.ToInt(CardType.SelectedValue);
if (strCurrencyCode == "EUR")
{
payment.Amount = AlwaysConvert.ToDecimal(GetOtherCurrencyPaymentAmount("EUR"));
payment.CurrencyCode = "EUR";
}
else
{
payment.Amount = GetPaymentAmount();
payment.CurrencyCode = "GBP";
}
Where GetOtherCurrencyPaymentAmount retrieves the amount in the user's selected currency, not the total in the stores primary currency type.

See any problems with my rationale??

I meant to say - the RealEx payment gateway can handle multiple currencies, so I don't know if I need to create a separate gateway for Euros.. do I?

Carolharry
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Wed Dec 17, 2008 9:13 am

Re: Passing local currency amounts to Payment Gateway and report

Post by Carolharry » Thu Apr 30, 2009 1:36 pm

May be someone in dev team from AbleCommerce suggest how to do. Just by assigning conversion amount is not solving the problem. The payment status etc still arenin pending/incomplete stage even though fully amount was charged.

niall08
Commander (CMDR)
Commander (CMDR)
Posts: 175
Joined: Tue Dec 09, 2008 10:29 am

Re: Passing local currency amounts to Payment Gateway and report

Post by niall08 » Fri May 01, 2009 5:20 am

So, if explicitly converting the amount and passing that amount and the currency type into the Payment object (and thus the Payment Gateway) isn't working, how is just creating a new Payment Gateway working for you? What's the process, and how is the amount paid in the user's selected currency??

Sorry - I just don't understand..

niall08
Commander (CMDR)
Commander (CMDR)
Posts: 175
Joined: Tue Dec 09, 2008 10:29 am

Re: Passing local currency amounts to Payment Gateway and report

Post by niall08 » Thu May 07, 2009 9:34 am

Anyone from the Dev team shed any further light on this issue??

keats76
Commander (CMDR)
Commander (CMDR)
Posts: 117
Joined: Sat Dec 15, 2007 4:45 pm

Re: Passing local currency amounts to Payment Gateway and report

Post by keats76 » Wed Jul 22, 2009 6:16 am

Any update on this? I may have to implement a similar solution in the near future.

Thanks!
Mike

Post Reply