-
cp .env.example .env
-
edit .env
PAYMONGO_EMAIL=
PAYMONGO_PASS=
PAYMONGO_LIVEMODE=
PAYMONGO_MERCHANT_NAME=
REFUND_POLICY_HRS=48
GOOGLE_SERVICE_ACCOUNT_EMAIL=
GOOGLE_SPREADSHEET_ID_FROM_URL=
GOOGLE_PRIVATE_KEY=
SES_ACCESS_KEY=
SES_SECRET_KEY=
SES_REGION=ap-northeast-1
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
Set Up Your Amazon SES Credentials
- TODO!
Sending Mail on Development
- TODO!
Increase SES Sending Limit for Production
- TODO!
run
netlify dev
command
- test http://localhost:8888/api in postman
JSON PAYLOAD
{
"reference_no": "dh5zPAn",
"message": "Unauthorized used of Credit Card",
"email": "[email protected]",
"type": "cancellation",
"mop": "BDO",
"mop_details": "Account No: 12345"
}
-
reference_no is required , and must be PAID for a refund request to be created
-
message is required
-
email is required
-
type is required
*Types of Refund
let types = [
"cancellation",
"back_order",
"defective",
"deceptive",
"counterfeit",
"missing",
"expired",
];
-
mop is required, is provided as frontend-matter on Hugo. mode of payment is where client wants to received their refund
-
mop_details is required
-
Go to Settings
-
Click Change Site Name
${username}-tss-fn-create-refund.${domain}.com
- make post request with Needed payload to
${username}-tss-fn-create-refund.${domain}.com/api