[Skip to main content](#vessel-content)

#   Reject purchase/checkout if licence generate fails

##

- **[ohall](/forum/user/16115-ohall "View ohall's Profile")**
- [![ohall's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/16115-ohall "View ohall's Profile") Topic Author
- [ Offline](/forum/user/16115-ohall)

Less More

- Posts: 55
- Thank you received: 2
-
-

10 years 8 months ago [\#231882](#231882) by [ohall](/forum/user/16115-ohall "View ohall's Profile")  *[Reject purchase/checkout if licence generate fails](/forum/17-serial-how-to/882741-reject-purchase-checkout-if-licence-generate-fails#231882 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.9.0  Hi,  I'm creating serials at the point of checkout as they are composed of a hash of meta data about the order (product type, custom fields, etc.).  I've created a custom generator plugin for this - and that's all fine.  Is it possible to have the generate() method fail in a way that can abort the purchase? For example, if I validation of the custom fields fails, I'd like to abort the checkout rather than go on to take payment.  Is this possible? Thanks, Oliver")* was created by *[ohall](/forum/user/16115-ohall "View ohall's Profile")*

-- HikaShop version -- : 2.6.1
-- HikaSerial version -- : 1.9.0

Hi,

I'm creating serials at the point of checkout as they are composed of a hash of meta data about the order (product type, custom fields, etc.).

I've created a custom generator plugin for this - and that's all fine.

Is it possible to have the generate() method fail in a way that can abort the purchase? For example, if I validation of the custom fields fails, I'd like to abort the checkout rather than go on to take payment.

Is this possible?
Thanks,
Oliver

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODgyNzQxLXJlamVjdC1wdXJjaGFzZS1jaGVja291dC1pZi1saWNlbmNlLWdlbmVyYXRlLWZhaWxzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26401
- Thank you received: 4081
-
- [](http://obsi.dev)
-

10 years 8 months ago [\#231884](#231884) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Reject purchase/checkout if licence generate fails](/forum/17-serial-how-to/882741-reject-purchase-checkout-if-licence-generate-fails#231884 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.9.0  Hi,  I'm creating serials at the point of checkout as they are composed of a hash of meta data about the order (product type, custom fields, etc.).  I've created a custom generator plugin for this - and that's all fine.  Is it possible to have the generate() method fail in a way that can abort the purchase? For example, if I validation of the custom fields fails, I'd like to abort the checkout rather than go on to take payment.  Is this possible? Thanks, Oliver")*

Hi,

It is not possible during the generation of the serials because the order already exist and should be already confirmed.

The best would be to have an HikaShop plugin and perform that check during the "onBeforeOrderCreate" trigger.
[ www.hikashop.com/support/documentation/6...#onBeforeOrderCreate](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#onBeforeOrderCreate)
In that trigger you will be able to check the custom fields and cancel the order creation.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODgyNzQxLXJlamVjdC1wdXJjaGFzZS1jaGVja291dC1pZi1saWNlbmNlLWdlbmVyYXRlLWZhaWxzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[ohall](/forum/user/16115-ohall "View ohall's Profile")**
- [![ohall's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/16115-ohall "View ohall's Profile") Topic Author
- [ Offline](/forum/user/16115-ohall)

Less More

- Posts: 55
- Thank you received: 2
-
-

10 years 8 months ago [\#231973](#231973) by [ohall](/forum/user/16115-ohall "View ohall's Profile")  Replied by *[ohall](/forum/user/16115-ohall "View ohall's Profile")* on topic *[Reject purchase/checkout if licence generate fails](/forum/17-serial-how-to/882741-reject-purchase-checkout-if-licence-generate-fails#231973 "-- HikaShop version -- : 2.6.1 -- HikaSerial version -- : 1.9.0  Hi,  I'm creating serials at the point of checkout as they are composed of a hash of meta data about the order (product type, custom fields, etc.).  I've created a custom generator plugin for this - and that's all fine.  Is it possible to have the generate() method fail in a way that can abort the purchase? For example, if I validation of the custom fields fails, I'd like to abort the checkout rather than go on to take payment.  Is this possible? Thanks, Oliver")*

Thanks Jerome,

I've added some fairly tight validation regex to the custom fields, so hopefully, the generator shouldn't fail. If it becomes a problem, I'll take a look at the onBeforeOrderCreate, though I'd like to avoid too much customisation if I can! I only change the config of HikaShop once in a blue moon, so I very quickly forget where things are!!

Cheers,
Oliver

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzE3LXNlcmlhbC1ob3ctdG8vODgyNzQxLXJlamVjdC1wdXJjaGFzZS1jaGVja291dC1pZi1saWNlbmNlLWdlbmVyYXRlLWZhaWxzP3RtcGw9bWFya2Rvd24=) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

Moderators: [Obsidev](/forum/user/7040-obsidev "View Obsidev's Profile")

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.070 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
