Sending an e-mail to the customer on payment failure

Hello

I've tried finding how to do this in the documentation/forums but I haven't been able to find how to do it. Is this possible?

Thanks!
Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    edited June 2018
    @alextorres,

    Thanks for reaching out. Would I be correct in saying that you're wanting to send customers emails when their subscriptions fail to renew properly - giving them a chance to update their payment details?

    If so - we do support the ability to email reminders to customers, as well as automatically re-attempt their payments, on a customisable schedule. This is available as part of our subscription dunning functionality, which is found on the "advanced" settings page in the administration, and also some documentation on the different options available on our wiki here.

    I hope that helps!
  • alextorresalextorres Member
    edited June 2018
    Hello @fc_adam

    this would include anytime a client tries to pay with credit card and the payment is declined for any reason
  • fc_adamfc_adam FoxyCart Team
    @alextorres,

    Thanks for clarifying. We don't currently send emails to customers for payment errors when they're on the checkout. In that instance, the customer is redirected back to the checkout and they see the error straight away, allowing them to make changes and try again.

    If you're looking to track abandoned carts - there are a number of services that integrate with Foxy that you could utilise: https://www.foxy.io/integrations/cart-abandonment.

    If you specifically wanted to send customers emails on errors though - that could be possible, but would require some custom development, with a script on your side to handle sending the email, and triggering it from the checkout if you detect a payment error.
  • @fc_adam I think if payment errors on checkout are caught there and not allowed to go through, we don't need an email to be sent

    Going back to subscription failures, I had a read of that wiki page and do I understand correctly if I think 'Failed Transactions Reattempt Schedule' is the one I need to fill in the advanced settings so a customer receives an email?

    Thank you for your help!
  • fc_marijafc_marija FoxyCart Team
    Hi @alextorres -

    You're close, but you'll want to use "reminder email schedule:". This actually sends the emails. The "failed transactions reattempt schedule" retries the charge on the set schedule, but doesn't send emails. The reminder email schedule will send an email x number of days from the date of the first failure. So, if you wanted your customer to be reminded initially, then every 5 days, you'd set a value of "1,6,11" and so forth. Does that make sense?

    If you were to use these two things combined, the emails would stop sending once the subscription is in a paid up or successfully charged state.
  • Following up on this, 1 year later: is there a way for me to have the email sent to my inbox so I can show it to the client?
  • fc_adamfc_adam FoxyCart Team
    @alextorres,

    Good question. We don't currently have an automated way to receive a past due notification email for testing - it relies on the failed subscription being present for the email for the necessary variables to be set.

    That said - it is possible to fake it so you can see what the email would look like. If you have a test store, you could edit the email template to hard-code those values so that the email is sent as the past due notification. You wouldn't want to do this on a live store, as you open yourself up to the chance that a legitimate customer would get an incorrect email receipt.

    If you add the following to the top of the email receipt template (text, html or both), and trigger a previous subscription transaction to re-send from the admin, you should see the receipt come through as if it was a past due reminder email:
    {% set is_order = false %}
    {% set is_subscription_dunning_reminder = true %}
    {% set days_since_first_failed_transaction = 10 %}
    If you've only got a live store - you could still use this code, but wrap it in logic to ensure it only applies to a transaction you specify. For example:
    {% if order_id == "123456" %}
    {% set is_order = false %}
    {% set is_subscription_dunning_reminder = true %}
    {% set days_since_first_failed_transaction = 10 %}
    {% endif %}
    If you update that value to match your specific transaction ID you'll be resending, it should make sure any other transactions for your store behave as normal.
  • Hello @fc_adam

    we do have a dev store and I tried this, but no email receipt is being sent when I click the 'Refeed XML Datafeed' button on the transactions section of the dashboard
  • brettbrett FoxyCart Team
    Hi @alextorres. To test the way @fc_adam mentioned, you'd click the "email" link from the transaction page. Basically you're telling Foxy to resend the receipt email, and in the email template you're hardcoding some variables to trigger a certain type of email.

    That make sense? Let us know.
  • Hello @brett , @fc_adam

    I was able to trigger the email, thank you for that.

    But I received the email associated to the 'html message subscription dunning reminder' language option. Is there a way to receive the email associated to the 'html message expiring payment reminder' language option?

    image
  • fc_marijafc_marija FoxyCart Team
    Hello @alextorres -

    You can force the expiring email by doing the following:

    Add the following two lines to the top of the text email receipt template:
    {% set is_expiring_payment_reminder = 1 %}
    {% set is_order = 0 %}
    Set the credit card on a sub's customer to expire in the current month.

    Set expiring soon payment method email schedule: in advanced settings to the number of days from the end of the month. You can set 1 to 31 so you can catch it on any day you happen to test (1,2,3,4,5,etc).

    Just a heads-up ― we have a ticket out for a bug there that doesn't send the custom language string for card expiring soon emails, so if you're customizing that string, we'd recommend a different approach for changing it. You can contact us at help@foxycart.com if that's the case, and let us know the store. We'll be happy to give you step-by-step instructions for applying your changes.
  • Hello @fc_marija

    that worked. I'll send an email because our client needs a custom message
  • Hello,

    I have a question from our client:

    "The email notification looks good to me. I think it's clear enough. Just to confirm that once the card details are updated by the customer that the payment will be automatically taken, and there won't need to be any manual intervention from us?"

    is there a way for a customer to update their card details in a subscription?
  • fc_marijafc_marija FoxyCart Team
    Hello @alextorres -

    If a customer has a failed payment and updates their payment information, the store doesn't need to do anything. The customer's payment will be attempted according to the settings on the RECURRING BILLING SETTINGS section in the Advanced settings of the Foxy admin (https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures).

    The customer can update their payment details by clicking the sub_token link to their checkout. This can be accessed from their email receipt, or you can email them a link to make the change. On their email receipt, it's shown as "Update your payment information".

    If you want to email the link directly, it can be obtained by going into subscriptions (https://admin.foxycart.com/admin.php?ThisAction=ManageProductSubscriptions) in the Foxy admin and clicking the "Edit" button next to the desired subscription. The store can copy the "Direct to Checkout" link and send that to the customer, who will be prompted to log in upon clicking the link. Then they'll be able to change and save address details.

    If you have reminder emails set up for failed payments, the customer can also update their payment through the link on that email. You can access the settings to set up the reminder emails here: https://admin.foxycart.com/admin.php?ThisAction=EditAdvancedFeatures (field is Reminder Email Schedule:). It'd probably helpful to review the other settings there under RECURRING BILLING SETTINGS.

    There's also a way for the store to log in as the customer from the sub_token url, using a Unified Order Entry password. Here's a link to our wiki article on that: https://wiki.foxycart.com/v/2.0/unified_order_entry

    Hope that helps. Let us know if you need additional information or clarification.
  • fc_marijafc_marija FoxyCart Team
    Just popping back in after reviewing the entire thread ― I noticed we've mentioned these settings before, so that's a reminder there, I guess. One thing I want to add since we were talking about expiring soon emails ― you'll want to put that update link on your customized email if you want the customer to be able to click and update their payment details. Let us know if you need help doing that.
  • Hello @fc_marija

    This is the link on the default message

    https://{{ config.store_domain }}/cart?cart=updateinfo

    but when clicked, that link tries to go to a cart that doesn't exist anymore.

    Is the sub_token in a variable I can use to create the link on the email receipt template?

    Thanks

  • fc_marijafc_marija FoxyCart Team
    Assuming you're clicking on the rendered link in the email, the ?cart=updateinfo link should take the customer to a login where after they log in, they'll see their product in the cart. If you're not seeing anything there, it could be because you haven't entered a customer email and password. If you're seeing something else, like a specific error, feel free to post the error or a screenshot and we'll see if we can figure out what's going on.

    If you'd like to use the sub_token there, you can replace
    https://{{ config.store_domain }}/cart?cart=updateinfo
    with the following:

    {% set sub = subscriptions|first %}
    {{ sub.sub_token_url }}
  • alextorresalextorres Member
    edited July 4
    Hello

    I included the sub_token_url (https://plutopress-staging.foxycart.com/cart?sub_token=0a7c20ce90601f348b89b4f886e31607b28...) and it takes me to this page

    image

    I don't see a place to update my card details there. Am I doing something wrong?

    Thanks

  • fc_adamfc_adam FoxyCart Team
    @alextorres,

    Thanks for sharing a screenshot of what you're seeing. I believe I know what's happening there - the subscription is set to end the day after it starts, and the checkout is detecting that and considering the subscription in a cancellation state incorrectly. I'll ticket that on our side to be corrected.

    In the meantime, it may be worth switching back to the original updateinfo link instead. You noted that it takes you to an error page that the cart is missing. I believe this is related to the SSO endpoint for your store causing the cart session to lose the updateinfo state. I see you're using FoxyShop for the store, have you by chance customised the SSO endpoint there to perform a request to get the contents of the cart, through a cURL request for example?
  • Hello @fc_adam

    I tried the https://{{ config.store_domain }}/cart?cart=updateinfo link method again, and it looks like I only get the error when I go directly after login in when I click on the link, but if I go to https://{{ config.store_domain }}/cart?cart=updateinfo manually after having previously loged in, it brings me to:

    image

    which is the screen I need. I'll just change the working in the email and see if the client is happy with that
  • fc_adamfc_adam FoxyCart Team
    @alextorres,

    To confirm - if you're not currently logged in on your website, when clicking the updateinfo link, it takes you to your login page. Then after logging in, it directs you to the checkout but the error is present. If you're already logged in before going to that link, it works ok. Is that correct?
  • alextorresalextorres Member
    edited July 10
    correct @fc_adam
Sign In or Register to comment.