Giter Club home page Giter Club logo

gocommerce's Introduction

GoCommerce

A small go based API for static e-commerce sites.

It handles orders and payments. Integrates with Stripe for payments and will support international pricing and VAT verification.

GoCommerce is released under the MIT License. Please make sure you understand its implications and guarantees.

Setting up

See the example configuration for an example of how to configure GoCcommerce.

The most important setting is the site_url. GoCcommerce is always tied to a website, and will use the site URL to verify product prices, offers, and settings for countries, product types and VAT rules.

GoCommerce will also look for email templates within a designated site folder and use the site URL to construct links to order history.

Create a config.json file based on config.example.json - You must set the site_url and the stripe_key as a minimum.

What your static site must support

Each product you want to sell from your static site must have unique URL where GoCommerce can find the meta data needed for calculating pricing and taxes in order to verify that the order is legitimate before using Stripe to charge the client.

The metadata can be anywhere on the page, and goes in a script tag in this format:

<script id="gocommerce-product" type="application/json"> {"sku": "my-product", "title": "My Product", "prices": [{"amount": "49.99"}], "type": "ebook"} </script>

The minimum required is the Sku, title and at least one "price". Default currency is USD if nothing else specified.

Mail templates (Not implemented yet)

GoCommerce will look for mail templates inside https://yoursite.com/gocommerce/emails/ when sending mails to users or administrators.

Right now the mail templates are:

  • Order Confirmation gocommerce/emails/confirmation.html

VAT, Countries and Regions

GoCommerce will regularly check for a file called https://yoursite.com/gocommerce/settings.json

This file should have settings with rules for VAT or currency regions.

This file is not required for GoCommerce to work, but will enable support for various advanced features. Currently it enables VAT calculations on a per country/product type basic.

The reason we make you include the file in the static site, is that you'll need to do the same VAT calculations client side during checkout to be able to show this to the user. The commerce-js client library can help you with this.

Here's an example settings file:

{
  "taxes": [{
    "percentage": 20,
    "product_types": ["ebook"],
    "countries": ["Austria", "Bulgaria", "Estonia", "France", "Gibraltar", "Slovakia", "United Kingdom"]
  }, {
    "percentage": 7,
    "product_types": ["book"],
    "countries": ["Austria", "Belgium", "Bulgaria", "Croatia", "Cyprus", "Denmark", "Estonia"]
  }]
}

Based on these rules, if an order includes a product with "type" set to "ebook" in the product metadata on the site and the users billing Address is set to "Austria", GoCommerce will verify that a 20 percentage tax has been included in that product.

JavaScript Client Library

The easiest way to use GoCommerce is with commerce-js.

gocommerce's People

Contributors

biilmann avatar rybit avatar calavera avatar eliwilliamson avatar verythorough avatar

Watchers

James Cloos avatar  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.