Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Generate Unique Coupon on Purchase

jshlijshli Member
Hey all!

Not sure if this is possible, but I'd like to generate a unique discount code for someone whenever they purchase something so that I'm able to upsell them straight away. So, ideally, whenever someone buys something, they get sent an email with a unique discount code that expires in a few days.

Would love to know if it's possible, and if so, how I might be able to do that!

  • fc_adamfc_adam FoxyCart Team

    Thanks for posting! We don't currently support dynamically creating coupons natively - but there are a couple approaches you could take to achieve that kind of set up.

    At a basic level, you could integrate with our Webhooks, and have a coupon created with a large number of codes set for it. At the endpoint where you process the transaction webhook, you would grab one of the codes from your side (you could store it in a database for example, or in a text file), and generate an email to the customer sending them that code. You'd also want to make the code as sent wherever you're storing it on your side. This approach assumes that the discount you're wanting to apply is the same for all upsell emails.

    For a more advanced approach - you could dynamically create the coupon for each transaction using our API. You would still utilise the webhook to trigger this action after each transaction. The difference is that at your webhook endpoint, you would communicate with the API to create a new coupon, or add a new code to an existing coupon, before emailing the customer as above.

    If we can provide any further details on either option, let us know!
Sign In or Register to comment.