Go to file
Borna Rajković 7369777098 Reorganized code + migration to go1.22 2024-04-01 20:29:24 +02:00
api Reorganized code + migration to go1.22 2024-04-01 20:29:24 +02:00
db Reorganized code + migration to go1.22 2024-04-01 20:29:24 +02:00
domain Reorganized code + migration to go1.22 2024-04-01 20:29:24 +02:00
migration Reorganized code + migration to go1.22 2024-04-01 20:29:24 +02:00
templates Reorganized code + migration to go1.22 2024-04-01 20:29:24 +02:00
.gitignore Implemented gateway interactions 2023-07-10 10:10:13 +02:00
README.md Updated readme 2023-07-31 11:30:15 +02:00
db.go Reorganized code + migration to go1.22 2024-04-01 20:29:24 +02:00
docker-compose-deploy.yml Added support for stripe 2023-07-26 09:51:29 +02:00
docker-compose.yml Implemented gateway interactions 2023-07-10 10:10:13 +02:00
dockerfile Implemented gateway interactions 2023-07-10 10:10:13 +02:00
go.mod Reorganized code + migration to go1.22 2024-04-01 20:29:24 +02:00
go.sum Added support for stripe 2023-07-26 09:51:29 +02:00
main.go Reorganized code + migration to go1.22 2024-04-01 20:29:24 +02:00
makefile Reorganized code + migration to go1.22 2024-04-01 20:29:24 +02:00

README.md

Payment-poc

Sample application with multiple payment gateways supported

Includes:

Startup

To start using make sure to setup either environment variables listed below, or create .env file and copy variables below

PSQL_HOST=localhost
PSQL_PORT=5432
PSQL_USER=payment-poc
PSQL_PASSWORD=paymentPassword
PSQL_DB=payment-poc

AUTH=test:testPassword # credentials used for securing web page

BACKEND_URL=localhost:5281 # or url where application is deployed

Also, database is required for application to start, so you can start it with docker compose up -d

Payment gateways

All gateways used are optional, so they have to be turned on to be used, to turn payment gateway add all required environment variables and define it in PROFILE variable, profile is coma sepparated list eg. PROFILE=wspay,stripe,viva-wallet,mock

Mock

Simplest gateway - as the name says to turn it on only add mock to profile

WsPay

WsPay has two environment variables it requires

  • WSPAY_SHOP_ID - shop id given by wspay
  • WSPAY_SHOP_SECRET - password used for registering to wspay admin dashboard

Stripe

Stripe has only one environment variable

  • STRIPE_KEY - key generated on the stripe admin dashboard

Viva Wallet

Viva wallet has 5 environment variables

  • VIVA_WALLET_MERCHANT_ID - merchant id
  • VIVA_WALLET_API_KEY - api key
  • VIVA_WALLET_SOURCE_CODE - code of online store
  • VIVA_WALLET_CLIENT_ID - client id for online store define by source code
  • VIVA_WALLET_CLIENT_SECRET - secret for online store define by source code

Example .env

PSQL_HOST=localhost
PSQL_PORT=5432
PSQL_USER=payment-poc
PSQL_PASSWORD=paymentPassword
PSQL_DB=payment-poc

BACKEND_URL=http://localhost:5281
PROFILE=wspay,viva-wallet,stripe,mock
AUTH=test:testPassword

WSPAY_SHOP_ID=...
WSPAY_SHOP_SECRET=...

STRIPE_KEY=...

VIVA_WALLET_MERCHANT_ID=...
VIVA_WALLET_API_KEY=...
VIVA_WALLET_SOURCE_CODE=...
VIVA_WALLET_CLIENT_ID=...
VIVA_WALLET_CLIENT_SECRET=...