-
cp .env.example .env
-
edit .env
GOOGLE_SERVICE_ACCOUNT_EMAIL=
GOOGLE_PRIVATE_KEY=
GOOGLE_SPREADSHEET_ID_FROM_URL=
Set Up Google Services If Not Yet Set Up
- Create New Google Service Account
- Fill Up Service Account Details
- Add Role Owner
Create New Secret KEY
- Select JSON
- This will Download A JSON , Open that File which Will Contain GOOGLE_PRIVATE_KEY and GOOGLE_SERVICE_ACCOUNT_EMAIL
{
"private_key": "GOOGLE_PRIVATE_KEY", // COPY THIS AND PASTE TO YOU .env file
"client_email": "GOOGLE_SERVICE_ACCOUNT_EMAIL", // COPY AND PASTE THIS TO YOUR .env file
}
Get Google Spreadsheet ID
-
Go to this link: https://docs.google.com/spreadsheets/u/0/
-
Create A New Spreadsheet
-
Check The URL and Copy URL Segment and Paste to GOOGLE_SPREADSHEET_ID_FROM_URL
https://docs.google.com/spreadsheets/d/COPY-THIS-URL-SEGMENT/edit#gid=0
Grant Permission to GOOGLE_SERVICE_ACCOUNT_EMAIL
- Inside Your SpreadSheet ,Click Share Button , paste your GOOGLE_SERVICE_ACCOUNT_EMAIL
run
netlify dev
command
- test http://localhost:8888/api in postman
Raw JSON PAYLOAD
{
"username": "midascode",
"name": "Juan Dela Cruz",
"email": "[email protected]",
"type": "percent",
"amount": 10,
"active": true
}
-
NOTE: This Microservice Allows User To Submit A Request To Be Part of Referral Program
-
username is required
-
name is required
-
email is required
-
type is required and can either be fixed or percent, but defaults to percent
-
amount is an integer , defaults to 10
-
active can be set as Frontend-matter in Hugo on a Specific Page, defaults to false
-
commission is saved as a formula with referral code as criteria
-
withdrawable is saved as a formula with referral code as criteria and payout_date
-
Go to Settings
-
Click Change Site Name
${username}-tss-fn-create-referral.${domain}.com
- make post request with Needed payload to
${username}-tss-fn-create-referral.${domain}.com/api