Payment services (PagSeguro) in the Google Cloud with NodeJS
- A PagSeguro Account
- A Google Cloud Account
-
Enter Google cloud shell
-
Clone repository on your google cloud App Engine (flex environemnt for NodeJS)
git clone https://github.com/viktorRock/OrdersPlat.git
-
Set Environemnt Vars into app.yaml file, after enter Google cloud shell
- GOOGLE_SPREADSHEET_SCOPE - Usually
'https://www.googleapis.com/auth/spreadsheets'
but it can be one of these ones here - Pagseguro keys and auth info
- PAGSEG_URL -
- Production -
"https://ws.pagseguro.uol.com.br/v2/checkout"
- test enviroment -
"https://ws.sandbox.pagseguro.uol.com.br/v2/checkout"
- Production -
- PAGSEG_CLIENT_TOKEN - API token you received from PagSeguro
- PAGSEG_CLIENT_EMAIL - Your e-mail from the PagSegure Sign Up
- name and config_id: - You get it during Google tutorial after running
gcloud service-management deploy openapi.yaml
- Example
runtime: nodejs env: flex endpoints_api_service: # The following values are to be replaced by information from the output of # 'gcloud service-management deploy openapi.yaml' command. name: echo-api.endpoints.XXXXXXX-YYYYYYY.cloud.goog config_id: 2017-MM-DDzz env_variables: PAGSEG_CLIENT_EMAIL: 'pvmathiassilva@gmail.com' PAGSEG_CLIENT_TOKEN: 'EX1DAE21468965315HDFAF589GS3689008' PAGSEG_URL: 'https://ws.pagseguro.uol.com.br/v2/checkout'
- PAGSEG_URL -
- GOOGLE_SPREADSHEET_SCOPE - Usually
-
Deploying on Google Cloud Endpoints - Tutorial
- Install curl
- Set environment variables
- Run the following command
- Windows
curl -vv -H "Content-Type: application/json" -d "@data.json" "%ENDPOINTS_HOST%/uolcheckout?key=%ENDPOINTS_KEY%"
- Linux
curl -vv -L -d '@data.json' -H 'Content-Type: application/json' "${ENDPOINTS_HOST}/uolcheckout?key=${ENDPOINTS_KEY}"
- Windows