This repository contains a starter for selling digital goods via ethPay. It illustrates how to configure ethPay instant access to give customers instant access to their purchase.
Hava a look at the sample Subdirectory which contains a Dockerfile to quickly set up the starter. Copy some media files into the files directory and build the Docker image.
Once the container is started you need to configure your store to use it as instant access endpoint. Read here how this is done easily.
Afterwards you are ready to sell the media files and let the customer directly download them just by providing them an URI like this:
- https://eth.de.com the URI prefix which supports the redirection to a website if it is not opened from within a mobile device or if no suitable wallet is installed
- 0x2b2d1F98206d199F23C5C51fB1dEDBd8D543Aabf the store address which will receive the payment of this purchase
- 11 an arbitrary number which is stored publicly on the blockchain alongside the purchase
- Pretzel+Picture the product title which is shown to the customer
- 4.50 and EUR the price which should be payed for the product
- pretzel.jpg the name of the file you put in the files directory
How does it work?
When a merchant enables instant access, he needs to provide an endpoint. This endpoint will be opened by the customer to access the purchase. Everytime the customer wants to access his purchase, the Wallet application adds a parameter to the endpoint which can be used to authenticate the customer.
- theconfiguredendpoint.xxx the endpoint which was configured
- ethpay the HTTP GET parameter name which is added to the endpoint
- 0xabcd the store address of the corresponding purchase
- Qmxxx the purchase receipt. The purchase receipt is unique for every purchase
- 1024 the timestamp of the request
- FFFFFF the signature of the previous parts (0xabcd-Qmxxx-1024) and used to authenticate the customer
Have a look here to see how the signature can be verified.