-
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
{
"reference_no": "dh5zPAn"
}
-
reference_no is required
-
throws error when not found in sheet
-
returns all data in specific row where reference_no is matched.
EXAMPLE JSON RESPONSE
{
"reference_no":"dh5zPAn",
"pm_link":"https://pm.link/test/test/dh5zPAn",
"payment_id":"pay_fA1B2STsdJd1QoyfbaeUUun3",
"paid":"yes",
"date_paid":"2020-5-16",
"mop":"GCash","currency":"PHP","net_amount":"971","fee":"29","payout_date":"2020-5-19","referral_code":"midascode","referral_fee":"97.1",
"sent":"",
"courier":"",
"tracking_no":"",
"received":"",
"deliverable": true,
"order_details":"This is an Example Paymongo Create Link On Checkout",
"receiver_name":"Midas Code Breaker",
"receiver_phone":"roo5xUi",
"notes":"7CbbxoP",
"delivery_address":"No Permanent Address",
"payer_name":"Mongo Bean",
"payer_email":"mrbean@gmail.com",
"payer_phone":"9155609040",
"billing_address":"12th floor The Trade and Financial Tower u1206 32nd street and 7th Avenue,Taguig Bonifacio Global City 1630, PH"
}
-
Go to Settings
-
Click Change Site Name
${username}-tss-fn-get-purchase.${domain}.com
- make post request with Needed payload to
${username}-tss-fn-get-purchase.${domain}.com/api