MCPcopy Index your code
hub / github.com/abishekmuthian/open-payment-host

github.com/abishekmuthian/open-payment-host @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
1,294 symbols 5,048 edges 203 files 1,024 documented · 79% updated 5mo ago★ 230
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Open Payment Host

Version 0.3.6 Go HTMX hyperscript TailwindCSS SQLite

Sell Subscriptions, Newsletters, Digital Files without paying commissions.

<img src="https://github.com/abishekmuthian/open-payment-host/raw/main/demo/Square/4.post.gif">

What

Open Payment Host is an easy to run self-hosted, minimalist payments host through which we can easily sell our digital items without paying double commissions while having total control over our sales and data.

Why

Selling digital items on web as an indie requires using platforms where we have to pay double commissions(to the platform and the payment gateway) and our content is forever locked within those platforms.

Who

  • Those who are looking to self-host an alternative for Gumroad, Buy Me a Coffee, Ko-fi etc.

  • Those who churn out lot of projects and don't want to integrate payment gateway every time.

  • Those who want to use multiple payment gateways for different countries e.g. for parity pricing or for redundancy.

How

Open Payment Host is a minimalist yet highly performant Go web application with innovative features which helps indies self-host and sell digital items with little effort.

One Click Deployment

Deploy on Railway

Features

  • WYSIWYG editor to create beautiful product pages.
  • One Time and Subscription payments support.
  • Stripe support, Just add the price id for the product and rest is done automatically.
  • Paypal support, Just add the plan id for the product and rest is done automatically new.
  • Razorpay support, Just add the plan id for the product and rest is done automatically new.
  • Square support, Just add the amount for the product and rest is done automatically.
  • Customers can buy without logging in, Increases conversion.
  • Multi-country pricing, Price changes automatically according to the user's location resulting in better conversion.
  • Light and Dark theme.
  • Mailchimp support, Customers are automatically added to a mailchimp list; Useful for sending newsletters.
  • File attachment support(images) for the product posts.
  • S3 support for delivering digital files via automatic pre-signed URL.
  • Subscriber count for the products.
  • Automatic SSL and other security features for production.
  • Automatic payment gateway router based on countrynew
  • API & Webhook experimental.

Production Demo

https://payments.abishekmuthian.com

WIP

This is a work in progress project, although I put lot of effort in ensuring security and stability of the platform users should be aware of possible unknown bugs. That said, I use Open Payment Host as payments host for my own projects.

Immediate Goals

  • [x] Product pages
  • [x] Stripe integration
  • [x] Square integration
  • [x] Paypal integration
  • [x] Razorpay integration
  • [x] Payment router
  • [x] File download
  • [ ] Documentation website
  • [ ] Accessibility

Long Term Goals

  • [ ] Paddle integration
  • [ ] PayU integration
  • [ ] Cashfree integration
  • [ ] Direct banking API integration
  • [ ] Community features
  • [ ] Localisation

If you would like to help me achieve these goals, consider sponsoring me

Screenshots

Home

Hope page of OPH

WYSIWYG editor

WYSIWYG editor

Buy without login

Square

Billing

No credit card data is stored locally

Stripe

Buy button

Square

Square web sdk

Strong customer authentication (3D-Secure, SCA) support

3D-Secure

File delivery after payment

Stripe

File delivery after payment after stripe payment

Square

File delivery after payment after square payment

Automatic payment gateway router

Paypal

https://github.com/user-attachments/assets/41c0d989-4a4f-43e4-8b54-f7938be3dda0

Razorpay

https://github.com/user-attachments/assets/86ea6d40-37cf-42f9-81f2-590671baa88c

Usage

Requirements

  1. Stripe or Square or Paypal or Razorpay account for payment gateway.

  2. Cloudflare account for turnstile captcha.

  3. Mailchimp account for adding subscribers to the list.

Note: Open Payment Host can be tested without fulfilling above requirements, But payments and adding subscribers to the list wouldn't work.

Docker

The latest image is available on DockerHub at abishekmuthian/open-payment-host:latest.

Demo Setup

mkdir oph-demo && cd oph-demo
sh -c "$(curl -fsSL https://raw.githubusercontent.com/abishekmuthian/open-payment-host/main/samples/oph-demo/install-demo.sh)"

Visit http://localhost:3000.

Demo version prints more detailed level of errors if any, DO NOT use this demo setup in production.

Login

The default admin email id is admin@openpaymenthost.com and the password is OpenPaymentHost. You'll be asked to reset the password after login for security reasons. That password is hashed and stored.

You'll be logged out after changing password automatically to login with the new credentials.

Admin email id and default admin password can be changed in the config file (explained below) after the first run. Each time the password is reset in the config file, The password needs to be changed again once logged in for security.

Production Setup

It's recommended to try the demo application first before using the production application. The production application requires a registered domain and special config variables for SSL as detailed in the configuration section.

mkdir oph-production && cd oph-production
sh -c "$(curl -fsSL https://raw.githubusercontent.com/abishekmuthian/open-payment-host/main/samples/oph-production/install-production.sh)"

After the container has started successfully, Stop the container, Set the required production configuration and re-run the container.

Configuration

Config file fragmenta.json is located in the secrets folder. It is generated automatically during the first run, After editing the config file the application needs to be restarted for the new configuration to take effect.

fragmenta.json contains configuration for both development and production. The production configuration is loaded when the environment variable FRAG_ENV=production is set.

Note: Environment variable for production is set automatically when using the docker production setup.

User configurable values are included in the table below.

Key Description Value
admin_email Email id of the administrator. Default: admin@openpaymenthost.com
admin_default_password Default password of the administrator, Would be forced to changed after login. Default: OpenPaymentHost
reset_admin Reset the email and password of the admin during the next run. yes (or) no
domain Website domain name for the application. Dev: localhost, Prod: example
port Port of the application. Dev: 3000, Prod: 443 (SSL)
root_url FQDN for the application with protocol and port. Dev: http://localhost:3000, Prod: https://example.com
autocert_domains Comma separated domains for SSL certificates. Demo: NA, Prod: www.example.com, example.com
autocert_email email id for SSL certificate related notifications. Demo: NA, Prod: admin@example.com
autocert_ssl Enable or Disable automatic ssl Demo: NA, Prod: yes/no
name Name of the website. Default: Open Payment Host
meta_title Title of the website. Default : Sell what you want without paying commissions
meta_desc Description of the website. Default: Sell Subscriptions, Newsletters, Digital Files without paying commissions.
meta_keywords Keywords for the website. Default: payments,subscription,projects,products
meta_image URL for the featured image for the website. Default: /assets/images/app/oph_featured_image.png
meta_url Meta URL for the page when its not generated automatically. Dev: http://localhost:3000, Prod: https://example.com
square Enable the square payment gateway, When enabled all other square credentials are mandatory. Dev/Prod : yes,no
square_access_token Square access token for accessing your square account. Dev: Sandbox access token, Prod: Production access token
square_app_id Square app id to identify your application. Dev: sandbox-..., Production: production app id
square_location_id Square location id for the account Dev: Sandbox location id from test account, Prod: location id from the main account
square_notification_url Square notification url for the webhook. Dev:Sandbox webhook URL, Prod: Production webhook URL
square_signature_key Square signature for webhook authentication Dev: Sandbox webhook signature, Prod: Production webhook signature
square_sandbox_source_id Square sandbox source id for credit card Dev: cnon:card-nonce-ok, Prod:""
square_domain Square API domain Dev: https://connect.squareupsandbox.com/v2, Prod: https://connect.squareup.com/v2
s3_access_key S3 compatible access key Dev: NA,Prod: NA
s3_secret_key S3 compatible secret key Dev: NA, Prod: NA
stripe Enable the stripe pay

Extension points exported contracts — how you extend this code

Parser (Interface)
Parser loads template files, and returns a template suitable for rendering content [4 implementers]
src/lib/view/parser/parser.go
Selectable (Interface)
TODO flip the select helpers to use Selectable all the time? Redefine concrete type Option as a Selectable and this shou [4 …
src/lib/view/helpers/forms.go
PrintLogger (Interface)
PrintLogger defines an interface for logging to a text log. [3 implementers]
src/lib/mux/log/log.go
Resource (Interface)
Resource defines the interface for resources [3 implementers]
src/lib/auth/can/can.go
Logger (Interface)
Deprecated - use server/log pkg instead to log Logger interface for a logger - deprecated for 2.0 [3 implementers]
src/lib/server/deprecated.go

Core symbols most depended-on inside this repo

AddKey
called by 285
src/lib/view/render.go
Error
called by 271
src/lib/server/log/log.go
Fatalf
called by 254
src/lib/server/deprecated.go
Info
called by 223
src/lib/server/log/log.go
Get
called by 197
src/lib/server/config/config.go
Get
called by 167
src/lib/mux/mux.go
InternalError
called by 115
src/lib/server/errors.go
Add
called by 76
src/lib/mux/mux.go

Shape

Function 651
Method 449
Struct 163
Interface 18
TypeAlias 8
FuncType 5

Languages

Go97%
TypeScript3%

Modules by API surface

src/lib/query/query.go50 symbols
src/lib/query/query_test.go34 symbols
src/lib/mux/mux.go27 symbols
src/subscriptions/paypalCreateOrder.go26 symbols
src/lib/mux/route.go25 symbols
src/lib/view/helpers/helpers.go23 symbols
src/lib/view/render.go22 symbols
src/lib/view/parser/template.go22 symbols
src/lib/view/helpers/forms.go22 symbols
src/lib/mux/params.go22 symbols
src/products/story.go21 symbols
src/lib/query/adapters/database.go21 symbols

For agents

$ claude mcp add open-payment-host \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact