Hosting & Domaining Forum

Hosting Discussion => Web Hosting => Topic started by: solomankane on Mar 20, 2023, 12:08 AM

Title: How to ship electronic goods?
Post by: solomankane on Mar 20, 2023, 12:08 AM
Hello!

I need help implementing a functionality in an online store script that currently doesn't support shipping electronic goods like ebooks and video materials. I'm not sure how to approach this yet. Can you please assist me with the algorithm for handling the shipment and the overall solution architecture?

Ideally, this is how it should work:
1) The buyer selects the product and completes the payment.
2) After the payment is made, the buyer receives a unique link to download the purchased materials. This link should be valid for a limited time.
3) Profit =)

However, I have several questions:
1) What would be the best way to store the materials? Should I use an FTP server or a file hosting service?
2) How can I generate a unique link for each buyer while keeping it constant relative to the resource?
3) What protective mechanisms should I implement to prevent the sharing of this link? Should I consider factors like lifetime, IP binding, or SMS confirmation?
4) How can I secure the materials stored in the system? Would access rights be sufficient?

Unfortunately, I haven't been able to come up with a solution yet, so any advice or thoughts from your experience would be greatly appreciated.

It's important to note that I won't be able to replace the existing store script with a more functional one, so I'll need to work with what I have.

As I'm still relatively new to development, I would really value your input and guidance on this matter.
Title: Re: How to ship purchased electronic goods?
Post by: ZoriWser on Mar 20, 2023, 01:12 AM
I am in favor of implementing a personal account feature. All resources purchased by the user should be consistently accessible to them through their personal account. When the user logs into their account, it should display a list of their purchased resources, and upon clicking the Download button, the corresponding files should be made available to them.

If, however, there is a need to distribute links without a personal account (for instance, if the user pays via SMS and receives a link in return), it would be necessary to include a key within each link. This key would be generated specifically for the corresponding resource and have a limited validity period, such as a week or two days (further consideration is required on this aspect).

 there is always a possibility of users uploading the downloaded files to file sharing platforms and sharing public links with others. Therefore, it may not be necessary to invest too heavily in preventing this behavior (e.g., by creating links with short validity periods or restricting downloads to only one attempt).
Title: Re: How to ship purchased electronic goods?
Post by: Stechnians on Mar 20, 2023, 02:06 AM
To ensure access control, you have the option to record and store keys transmitted through the link in a database. When a user clicks on the link, the system can verify whether access is granted based on the key and associated product.

Assuming all checks pass successfully, you can deliver the file to the client using a script. The actual location of the file can be anywhere, including forwarding it with an FTP script. However, it's important to use a lightweight web server if there will be a high volume of simultaneous downloads to ensure smooth performance.

Alternatively, when considering this approach, instead of making file copies for each user, you can create symbolic links (simlinks) to the original file with unique addresses for each user. These simlinks can be automatically deleted after their expiration date to manage access control.
Title: Re: How to ship purchased electronic goods?
Post by: shawnblog on Mar 20, 2023, 02:47 AM
As part of the solution, we can provide the customer with a temporary link within their store account on the website. Assuming the product has a relatively small size, such as 5 megabytes, the download should be quick and efficient. To address concerns about users with slower connections, we can set a lifetime of 60 minutes for the link.

To ensure that only the intended user can access the file, we can employ a cookie mechanism. Upon the user's request for the link, a cookie can be set, and this cookie will be checked each time the file is accessed via the link. Additionally, it is essential to store the file on our server. As we generate the link, we can copy the file to a temporary directory. Once the link's lifetime expires, the file will be removed.

While this approach seems suitable, there may be other inventive solutions worth exploring. By further contemplating the requirements and considering alternative ideas, we can potentially discover new approaches to enhance the functionality.
Title: Re: How to ship electronic goods?
Post by: Nicpoint45 on Jul 13, 2023, 03:12 AM
Let's go through each of your questions and discuss the possible solutions:

1) Storing the materials: There are multiple options available for storing the materials. You could use an FTP (File Transfer Protocol) server, a cloud storage service like Amazon S3 or Google Cloud Storage, or even store the files directly on your web server. The choice depends on factors such as cost, scalability, and ease of implementation.

2) Generating unique links: To generate unique links for each buyer, you can utilize a combination of unique identifiers like order numbers or UUIDs (Universally Unique Identifiers). These identifiers can be associated with the buyer's purchase and used to generate a unique download link. You can store this mapping in your database, associating the link with the specific buyer and purchased materials.

3) Preventing link sharing: Implementing protective mechanisms is crucial to prevent unauthorized access to the download links. Some approaches you can consider include:
  - Setting an expiration time for each download link so that it becomes invalid after a certain period.
  - IP binding, where the download link is bound to the IP address used during purchase. This can limit access to the materials from different IP addresses.
  - SMS confirmation, where the buyer receives a one-time password (OTP) via SMS and needs to enter it to access the download link. This adds an extra layer of security.

4) Securing the materials: Access rights are indeed important to ensure the materials are secure. You can configure file permissions to restrict direct access to the files without going through your online store script. Additionally, if you choose to store the files on a cloud storage service, you can take advantage of their built-in security features like access control lists (ACLs) and encryption at rest.

Considering your constraint of not being able to replace the existing store script, you can integrate the above functionality as an additional module or extension. This way, you can maintain the existing functionality while extending it to support electronic goods.

Remember to test your implementation thoroughly to ensure it functions as expected and provides the necessary security measures. Good luck with your project, and feel free to ask further questions if you need more assistance!
Title: Re: How to ship electronic goods?
Post by: ringonaTs on Jul 02, 2025, 02:21 AM
File hosting services like Dropbox or OneDrive are convenient but lack granular control and automation. Go cloud-native with object storage and leverage signed URLs for ephemeral access. Generate unique tokens per purchase, store them in your DB with timestamps, and validate on download requests.

Protect links by expiration and download limits, IP locking is brittle, SMS adds friction and complexity - better to focus on backend throttling and logging. Secure files by placing them outside public webroot and serving via authenticated endpoints only. Since you're stuck with your store script, consider a proxy layer or serverless function to handle downloads securely.
Title: Re: How to ship electronic goods?
Post by: Ocean Tattoos on Jul 22, 2025, 05:26 AM
When shipping electronic goods, use original packaging if available, ensure secure padding, choose a reliable courier, and always opt for insurance and tracking to safeguard against damage or loss during transit.