May I ask your thoughts of how to do/manage these issues.
I have a billing address and a shipping address in my order process.
Should I save the billing address under the data type USER? And should it be of form LIST, since a user may later change his billing address? Or just write over the old one when a new billing address is entered?
The shipping address may be different for each order for a USER. Do I save the Shipto address in the ORDERS data type or in the USER?
What parameter in Stripe plugin do I track to determine that the order went through, so I can make the order complete?
Any thoughts and ideas on how to manage downlink (eBooks)
purchased?
Hey Charan, I saw this post this morning but thought at least someone would reply
Depends how advanced you want this to be. I’ve seen some websites you can store multiple billing addresses, and at checkout you pick from the list. You would be dealing with another datatype though and managing that. If you want to keep it simple just overwrite it.
When you place your order though you should also having billing address fields on that, when they place it it sets the Order’s billing address to the User’s billing address, or at least pre-fill it in. That way if they change theirs later all past ordered aren’t referencing the new address.
Same thing, store on the User, on order creation set the Order’s address to the User’s one.
I have not used Stripe, but from seeing on the forum: You’re supposed to configure a webhook in your Stripe account, so on successful payment Stripe actually sends an API call to your app containing the order ID, and other info. It would call one of your API workflows, then your workflow would Do a Search for Order in your database with a constraint [stripe's orderid] = order ID then :first item. This would mean you create an order (setting the orderID field) when you send the User to the Stripe checkout page.
If you mean download links, maybe under your product type you have a yes/no field for “Digital download”. Then another field for the link to download it. When that webhook comes in you could have it trigger another API workflow when the yes/no field is yes. That would send an email to the Buyer’s email with the link. The only problem I can think of is it’s not an expiring link, so it’s a forever-working download link for people to share… not sure about how to handle that one…
Hello Tyler, thanks so much. You helped me a lat with organizing the organization.
I have another question.
I want to add a field called QTY (quantity of each ordered item), which the user types in. How do I relate it to the item in the ORDER data? Seems it is parameter of the item ordered, but I can’t think how I would specify/structure it in data.
Thanks again.
Charan
This one is more complicated… you would need a Order datatype (sounds like you have that already) but then also another type Order Item, with fields like:
Order (Order) - Reference back to it’s actual order
Product (Product) - Reference to the product
Price (number) - Copies from the Products price so it’s “locked in” and stays the same even after the price is changed in the future
Description (text) - Copies from product so it’s also “locked in”
Qty. (number)
Total Price (number) - This would be Price x Qty to get the total for this one item.
There’s a lot more involved like how to recalculate the order total and everything but that’s the basic structure. I like to use database triggers to have it recalculate everything.