Giter Club home page Giter Club logo

donutshop's Introduction

๐Ÿฉ

donutshop is a simple way to connect a juicebox project to a printful store

built with:

Setup

Important

This is still a work in progress. Product images and printful products are hardcoded. The next steps are to make these dynamic and configurable.

  1. Clone the repo
  2. npm install
  3. cp blank.env.local .env.local
  4. Create a printful account and store
  5. Login with same account and create printful private token (help)
  6. Name the token, add an email (required), set expiration date, and set minimum scopes shown below, add to .env.local (help)
  7. Create a wallet connect project and add to .env.local
  8. Create an infura API key and add to .env.local
  9. Create a upstash redis instance and add to .env.local (used to track order nonces)
  10. Set the NEXT_PUBLIC_JUICEBOX_PROJECT_ID in .env.local to the juicebox project id (help)
  11. Deploy!

Ordering sequence

sequenceDiagram
    participant C as Checkout
    participant I as Initialize Order API
    participant J as Juicebox
    participant P as Place Order API
    participant F as Printful API

    C->>I: Request orderIdObj
    I->>I: Generate id
    I->>I: hmac(id, SECRET)
    I-->>C: { id, idHash }
    C->>J: pay(..., memo = idHash)
    J-->>C: { txnHash }
    C->>P: { txnHash, id, shippingAddress }
    P->>J: Fetch transaction details
    P->>P: check id = hmac(id, SECRET)
    P->>F: check order doesn't exist
    F-->>P: order doesn't exist
    P->>F: Place order with id
    F-->>P: order placed information
    P-->>C: Confirm order placed
Loading

donutshop's People

Contributors

jigglyjams avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.