credit card declined / custom email sent at CheckedOut event
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 36
- Joined: Mon Dec 08, 2008 10:41 am
credit card declined / custom email sent at CheckedOut event
Ok, so I needed to add some custom fields to the order confirmation email. I added logic to the CheckedOut event in a copy of the OnePageCheckout control to manually send an email. The problem is that the email is always sent even though the credit card is sometimes declined. Should I move this logic to another place?
-chad
-chad
Re: credit card declined / custom email sent at CheckedOut event
well you can wrap your Email sending code inside an if statement that can check the payment status before sending the Email. For example it could be something as below
Code: Select all
Order order = OrderDataSource.Load(e.OrderId);
if (order.PaymentStatus == OrderPaymentStatus.Paid)
{
//Your custom Email code here
}
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 36
- Joined: Mon Dec 08, 2008 10:41 am
Re: credit card declined / custom email sent at CheckedOut event
ok, but if it hasn't completed processing yet (not accepted or declined) then wouldn't that mean that an email wouldn't get sent? If that's the case then is there a better place to send that custom email after payment has been verified?
-chad
-chad
Re: credit card declined / custom email sent at CheckedOut event
Well then may be should put the code in the Website/Checkout/PaymentForms/ user controls. For example if you handle this for credit card payments then you can edit the CreditCardPaymentForm.ascx and locate the following code
You can put the Email code in success section of the code.
Code: Select all
if (checkOut)
{
//PROCESS A CHECKOUT
CheckoutRequest checkoutRequest = new CheckoutRequest(payment);
CheckoutResponse checkoutResponse = Token.Instance.User.Basket.Checkout(checkoutRequest);
if (checkoutResponse.Success)
{
if (CheckedOut != null) CheckedOut(this, new CheckedOutEventArgs(checkoutResponse.OrderId));
Response.Redirect(NavigationHelper.GetReceiptUrl(checkoutResponse.OrderId));
}
else
{
List<string> warningMessages = checkoutResponse.WarningMessages;
warningMessages.Insert(0, "The order could not be completed because the basket contents changed during checkout. Please review your basket contents and try again.");
}
}
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 36
- Joined: Mon Dec 08, 2008 10:41 am
Re: credit card declined / custom email sent at CheckedOut event
Thanks, I'll check it out and post my results back here
-chad
-chad
-
- Lieutenant, Jr. Grade (LT JG)
- Posts: 36
- Joined: Mon Dec 08, 2008 10:41 am
Re: credit card declined / custom email sent at CheckedOut event
At what point is the attempt made to actually charge the credit card? After looking at this code I noticed that on "success" it just fires the CheckedOut event which is basically where I'm currently sending the email. So when it gets to this point it seems like the payment still hasn't been approved or declined. Is this the case?
Re: credit card declined / custom email sent at CheckedOut event
The actual attempt to charge the card is implemented under the payment gateway you are using. For example if you have configured Authorize.Net as payment gateway then all attempts charge are happening in the Authorize.Net gateway code. If you want application to automatically capture the payments as well then in gateway configurations you have to set the option to Authorize and Capture.
Re: credit card declined / custom email sent at CheckedOut event
The CheckedOut event handler in OnePageCheckout page is the right place for this kind of code.
If you have set your payment gateway to authorize and capture in one step then in the CheckedOut even handler if e.CheckoutResponse.Success is true the customer has been successfully charged.
If you have set your payment gateway to authorize first step and capture later then in CheckedOut event handler if e.CheckoutResponse.Success is true it only means that the customers credit card has be 'authorized' successfully but it has not been charged yet.
If you have set your payment gateway to authorize and capture in one step then in the CheckedOut even handler if e.CheckoutResponse.Success is true the customer has been successfully charged.
If you have set your payment gateway to authorize first step and capture later then in CheckedOut event handler if e.CheckoutResponse.Success is true it only means that the customers credit card has be 'authorized' successfully but it has not been charged yet.
-
- Commander (CMDR)
- Posts: 121
- Joined: Wed Dec 17, 2008 9:13 am
Re: credit card declined / custom email sent at CheckedOut event
Hi Mazhar,
Where can I find Pay Pal Payflow Pro gateway code(source files path in Ablecommerce project). I would like to see how it is resolving Test mode transaction or live mode transaction.
Thanks alot,
Carol
Where can I find Pay Pal Payflow Pro gateway code(source files path in Ablecommerce project). I would like to see how it is resolving Test mode transaction or live mode transaction.
Thanks alot,
Carol
Re: credit card declined / custom email sent at CheckedOut event
PayFlow gateway source code is in dll. The gateway source code is not available in standard purchase. The live or test mode configuration option can be seen on the gateway configuration page in merchant module. Also you can have a look at the sample payment gateway
http://wiki.ablecommerce.com/index.php/ ... nt_Gateway
That can help you understand how live or test mode are handled in code.
http://wiki.ablecommerce.com/index.php/ ... nt_Gateway
That can help you understand how live or test mode are handled in code.
Re: credit card declined / custom email sent at CheckedOut event
The source of Authorize.Net is available in following thread here
viewtopic.php?f=47&t=5926
viewtopic.php?f=47&t=5926