Skip to content

moltin/moltin-micro-checkout

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

moltin-micro-checkout

⚡️ One-click moltin purchasing with Stripe

Deploy to now

Asynchronous microservice that enables one-click purchasing with moltin and Stripe. Built with Micro 🤩

  • Add the product to a cart
  • Checkout the cart (create an order)
  • Pay for the order (using the Stripe token)

Try out the demo app using this service here.

🛠 Setup

npm install

npm run dev

Create a .env at the project root with your moltin client_id.

MOLTIN_CLIENT_ID=

Both a moltin and Stripe account are needed for this to function. Be sure that your Stripe keys are attached to your moltin store. Learn more about that here.

⛽️ Usage

This service exposes a single POST endpoint which expects the following payload 👇

{
  "token": "tok_visa",
  "product": "648a0eb5-329b-4475-bd8e-5eed12d27b2c",
  "customer": "ec1332a3-7579-4129-90b1-4f0d2c4e38b5",
  "billing_address": {
    "first_name": "Jonathan",
    "last_name": "Steele",
    "line_1": "2nd Floor British India House",
    "line_2": "15 Carliol Square",
    "city": "Newcastle Upon Tyne",
    "postcode": "NE1 6UF",
    "county": "Tyne & Wear",
    "country": "United Kingdom"
  }
}

You can also pass an optional shipping_address object. If this omitted then billing_address value will be passed to the API.

"shipping_address": {
  "first_name": "Jonathan",
  "last_name": "Steele",
  "line_1": "2nd Floor British India House",
  "line_2": "15 Carliol Square",
  "city": "Newcastle Upon Tyne",
  "postcode": "NE1 6UF",
  "county": "Tyne & Wear",
  "country": "United Kingdom"
}

If a customer record does not exist, you can instead pass a customer object.

"customer": {
  "name": "Jonathan Steele",
  "email": "jonathan@moltin.com"
}

If a product record does not exist, you can instead pass a product object.

"product": {
  "name": "MULTI-VIBE 2",
  "sku": "MULTI-VIBE-MK2",
  "description": "Abstract, sculptural, refined and edgy with a modern twist.",
  "quantity": 1,
  "price": {
    "amount": 50000
  }
}

Learn more at the moltin API reference.

Releases

No releases published

Packages

No packages published