Paras Daryanani
2019-05-17T17:21:57Z
I want to use the Hotcakes REST API to create an order, process the payment using credit card information that is supplied to the endpoint, followed by marking the order as complete and sending the user an email receipt.

So far I've used the OrderCreate and OrderTransactionsCreate endpoints, assuming that these will create the order with the specified line items, followed by applying the payment transaction and carry out all related workflow tasks, i.e. charge for the payment using the credit card specified in the OrderTransactionDTO object, update the order and send out an email receipt.

It looks like my assumption is incorrect, because the workflow tasks don't seem to execute on their own. How would I go about implementing the above specified logic using the Hotcakes REST API?
Paras Daryanani
Co-founder & CTO @ Celestial Sites
[email protected]
Will Strohl
2019-05-23T17:35:16Z
There is a great deal of work and logic that goes into the checkout process (above and beyond the workflow). Could you please provide additional details about how and why you're going around the checkout process so we can best understand how to respond with assistance?
Will Strohl, Upendo Ventures
Hotcakes Cloud  | Get Support  | Code Support 
Official Cloud & Support provider for Hotcakes
Paras Daryanani
2019-05-23T19:18:42Z
My objective is to create a scheduled task places recurring orders for customers in a Hotcakes website. The scheduled job uses an external database to fetch customer details, including the customer billing address, shipping address, credit card info (number, expiry and cvc). After fetching the customer details, an order should be created in Hotcakes and the customer credit card should be charged.

I expect all relevant workflow tasks to take place, i.e. assign order number, set order status to 'placed', apply a transaction and charge the credit card, set order status to paid if successful etc ( just as the website usually works when a user places an order through the Hotcakes frontend).

At the moment, this is what actually happens:
1. Using the OrderCreate endpoint, an order record is saved in the Hotcakes database (but doesn't show up in the Hotcakes sales dashboard)
2. Using the OrderTransactionsCreate endpoint, a transaction record is saved in the Hotcakes database. This does not however charge the credit card. The order is still invisible in the Hotcakes sales dashboard.

Bottom line: The order is not actually processed in Hotcakes. Only a db row is inserted in the orders table and another db row is inserted in the transactions table. Credit cards are not charged and orders are not confirmed.

My questions is, how can I implement the end-to-end ordering process in my scheduled task, i.e.:
1. create order
2. assign order number
3. charge credit card and apply transaction to order
4. if step 3 is successful, set order to complete (it's a non-shipping product) and email the customer
5. if step 3 is not successful (e.g. card declined), set order to unpaid and email the customer
Paras Daryanani
Co-founder & CTO @ Celestial Sites
[email protected]
Will Strohl
2019-05-27T17:52:57Z
Ah... That makes sense. Do you think you're going to be able to submit that as a pull request? 🙂

You're going to need to duplicate much of the logic highlighted in the link below, in order to get this to work as you expect.

https://github.com/hotca...ontroller.cs#L1104-L1173 
Will Strohl, Upendo Ventures
Hotcakes Cloud  | Get Support  | Code Support 
Official Cloud & Support provider for Hotcakes
Paras Daryanani
2019-07-01T13:36:17Z
Thanks Will, that was indeed very helpful. I've implemented this in the form of a new "CheckoutHandler" that has its own API endpoint + a new CheckoutDTO class that's analogous to a slimmed down version of the CheckoutViewModel class.

I'm currently cleaning up useless code and doing some testing, after which I'm happy to submit an issue and a pull request on Github.
Paras Daryanani
Co-founder & CTO @ Celestial Sites
[email protected]
Loading
  • Sign-up for the Hotcakes Community Newsletter: