# E-Commerce

electroniccommerceecommercepaymentonline
  • Supply chain management
  • Internet Marketting
  • Online transaction Processing
  • Inventory management
  • Data Collection

E-commerces is the largest sector of electronic industry

~ wikipedia

Shopping car is like git staging area for next commit. Subsets of products to process paynment for.

# Online goods and services

  • e-books
  • music - iMusic
  • Softwares - SaaS
  • Royality

Unprecedented increase in e-commerce after COVID 2020

Statistic: Most popular online retail websites worldwide in June 2020, by unique visitors (in millions) | Statista
Find more statistics at Statista

# Payment Processing Services

  • Unified Payments Interface (UPI) - India
    • Unlike traditional mobile wallets, which takes a specified amount of money from user and stores it in its own accounts, UPI withdraws and deposits funds directly from the bank account whenever a transaction is requested.

# Sell PDF

# Digital delivery system

  1. User window shops
  2. User selects his purchases 0-*
  3. Makes Payment
  4. Post payment Processing - Deliver goods.
    1. Redownload window in case they loose it
  5. Launch your own affiliate program

# Digital Media

  1. Files like PDF, epub
  2. Videos like mp3
  3. Presentations
  4. animations
  5. Artwork

# Webhooks

Webhooks are APIs requests but in reverse.

~ Anonymous
  • Webhooks and APIs differ in how they make requests.
  • https://cloud.google.com/free/
  • Firebase Functions - javascript
    • Google cloud functions in python, Go, java, nodejs
How to test webhooks locally? in development phase?

Tunneling software like ultrahook or ncroc

Have to update URL everytime is using a free version. How to do better? enter Stripe CLI

HOw to deal with JSON on CLI?

Use jq tool. Its like sed and awk but for JSON

# Stripe Payment

What should happen before payment?

  • Enter CC info
  • parse and send back to us a unique ID
  • Use dotenv only when NODE_ENV (set by node itself) is not production
    • use dotenv only when in development mode
  • Add prices in pennies (avoid floating point errors)
  • StripeCheckout, token function is called when after card information is captured and submitted
  • To use your API key, assign it to stripe. The Node.js library will then automatically send this key in each request.
  • Idempotence operations
  • Can add discount coupons, Promotion Code
  • Payments from client side needs to be verified by server as they could be manipulated by attacker
    • Charge customer based on the price on backend
    • strip will verify and return a token
    • firebase cloud function to handle verification
    • Client Side
      • you define your products directly in the Stripe Dashboard and reference them by ID on the client side.
  • Prebuilt UI Elements
  • Webhook - like sending an order confirmation email to your customer, logging the sale in a database, or starting a shipping workflow
  • https://youtu.be/jJH56H67yOE
  • Would have to use firebase middleware to add cors middleware to request
    • else request might not pass
    • might work from browser but not from postman
  • Checkout page should load stripe.js direcctly from server to remain PCI compliant

What should happen after payment? nd, decline

  • Pricing
  • Can send emails, invoices post payment to customer for free
  • Currency Support
  • Currency conversion
    • Stripe supports processing charges in 135+ currencies allowing you to present prices in a customer’s native currency. Doing so can improve sales and help customers avoid conversion costs.
  • Link with transferwise account to accept payments in USD, EUR, GBP, NZD, AUD
  • Payout When you start processing live payments from your customers with Stripe, you won’t receive your first payout until 7–14 days after receiving your first successful payment.
  • Stripe with google pay
  • Checkout Flow

TIP

Apple Pay and Google Pay are enabled by default and automatically appear in Checkout when a customer uses a supported device and has saved at least one card in their digital wallet.

  • Use the Dashboard, a custom webhook, or a third-party plugin to handle post-payment events like sending an order confirmation email to your customer, logging the sale in a database, or starting a shipping workflow.

Stripe payment workflow

# Resources

# NOdejs Hosting

RedHat OpenShift is highly recommended for first timers because it offers free Node.js hosting forever

# Questions

# How to design a ecommerce websites?

  • Usecases
    • Create user profile
    • List products
    • add/remove product to cart
    • Purchase products
    • Payment processor API
    • Track order
  • Database Model
    • users
    • products
    • orders
  • Concurrency
    • What if 2 users tryign to buy same thing
  • APIs
  • Split page information into sections
  • UI Features
    • Keyboard shortcuts
    • How to use tutorial? Help

# Payment Standards

# Implement Authentication with route guards

# Resources

  • or
  • Buy me a coffeeBuy me a coffee