01cloud-payments is a Go-based billing and payment service for managing payment gateways, invoices, transactions, thresholds, and billing workflows.
It is designed as a standalone HTTP service with PostgreSQL persistence and Swagger-powered API documentation, making it easier to integrate into a larger SaaS or platform stack.
- Multi-gateway payment support with Stripe integration and helper utilities for PayPal and PayU
- Invoice, invoice-item, transaction, payment-history, and payment-setting APIs
- Promo-code and payment-threshold workflows
- Scheduled billing and payment reminder endpoints
- Swagger/OpenAPI docs served by the application
- Unit tests for controllers and models
- Go
- Gin
- GORM
- PostgreSQL
- Swagger / Swaggo
- Docker
- Go 1.15 or newer
- PostgreSQL
- Docker, if you want to use the containerized workflow
- Clone the repository.
- Create a local environment file:
cp .env.sample .env- Update the database and integration settings in
.env. - Start the API locally:
make run-devThe service runs on http://localhost:8080 by default.
Build the runtime image:
docker build -t 01cloud-payments .Run the container:
docker run --rm -p 8080:8080 --env-file .env 01cloud-paymentsRun tests:
make test-devRun formatting and verification:
make format
make fmtcheck
make vet
make lintRun the public CI-equivalent checks locally:
make ciUse .env.sample as the source of truth. Important variables include:
DB_HOST,DB_PORT,DB_DRIVER,DB_USER,DB_PASSWORD,DB_NAMEPAYMENT_APIPAYMENT_SUCCESS_UI_URL,PAYMENT_FAILED_UI_URLEXCHANGE_RATES_API_KEYBASE_URL,API_SECRETINVOICE_PATH,EMAIL_TEMPLATE_PATHHOST_URL,EMAIL_LOGO_URLSMTP_HOST,SMTP_PORT,SMTP_USERNAME,SMTP_PASSWORD,SMTP_FROM_ADDRESS
Fetch exchange rates:
curl -X GET http://localhost:8080/payment/ratesInitialize a Stripe payment:
curl -X GET "http://localhost:8080/payment/init/stripe?amount=25" \
-H "x-user-id: 1"Swagger UI:
http://localhost:8080/payment/swagger/index.html
cmd/server: application entrypoint and generated Swagger docsinternal/controllers: HTTP handlers and route wiringinternal/models: database models and persistence logicinternal/util: config, email, and payment utility helperspkg: shared response and formatting helpers
Contributions are welcome. Please read CONTRIBUTING.md before opening issues or pull requests.
Please report vulnerabilities privately as described in SECURITY.md.
This project is currently licensed under Apache 2.0. See LICENSE.