Realiza pagos con Google Pay
Made by Google Pay
Realiza un pago con Google Pay mediante uno o más Proveedores de servicios de pago compatibles y escribe la respuesta en Cloud Firestore.
Cómo funciona esta extensión
Use this extension to make payments with your preferred Payment Service Provider (PSP) using Google Pay.
With this extension installed, you can pass a payment token from the Google Pay API to your Cloud Firestore database. The extension will listen for a request written to the path defined during installation, and then send the request to the PSP's API. It will then write the response back to the same Firestore node.
Write the following JSON payload to your Cloud Firestore instance to make a payment request:
{
psp: 'braintree',
total: 100,
currency: 'USD',
paymentToken: <Google Pay API payment token>
}
As you can see, the PSP is specified in the request payload, which means you can configure and support multiple PSPs using this extension. The following PSPs are currently supported (the value for the 'psp' field above is noted in parentheses):
- Adyen (adyen)
- Braintree (braintree)
- Checkout.com (checkoutltd)
- Cybersource (cybersource)
- Square (square)
Additional setup
Before installing this extension, make sure that you've created an account with your selected PSP. When installing this extension, you will need to provide PSP-specific configuration in the form of a JSON string. These are the expected configurations for each PSP:
js
{
"environment": "",
"merchantAccount": ""
}
js
{
"environment": "Sandbox",
"merchantId": "",
"publicKey": ""
}
js
{
"publicKey": ""
}
js
{
"authenticationType": "",
"runEnvironment": "",
"merchantID": "",
"merchantKeyId": ""
}
js
{
"environment": ""
}
Each PSP also requires a parameter that the extension will store using Cloud Secret Manager , such as an API key or access token, specific to the PSP.
Billing
To install an extension, your project must be on the Blaze (pay as you go) plan
- You will be charged a small amount (typically around $0.01/month) for the Firebase resources required by this extension (even if it is not used).
- This extension uses other Firebase and Google Cloud Platform services, which have associated charges if you exceed the service’s free tier:
- Cloud Firestore
- Cloud Secret Manager
- Cloud Functions (Node.js 10+ runtime. See FAQs )
You are also responsible for any fees charged by the PSPs you use.
Cómo instalar esta extensión
Usa Firebase console
Puedes usar Firebase console para instalar y administrar las extensiones.
Instala con consoleUsa Firebase CLI
También puedes usar Firebase CLI para instalar y administrar las extensiones.
Paso 1: Ejecuta el siguiente comando npm para instalar la CLI o actualizarla a la versión más reciente.
npm install -g firebase-tools¿No funciona? Consulta la referencia de Firebase CLI o cambia tus permisos de npm .
Paso 2: Configura un nuevo directorio de proyecto de Firebase o navega a uno existente
Paso 3: Agrega esta extensión al manifiesto de tu extensión ejecutando
firebase ext:install google-pay/make-payment --local --project=projectId_or_alias
Step 4 (Optional): Test this extension locally with the Firebase Emulator Suite
firebase emulators:start
Paso 5: Implementa las extensiones en el manifiesto de tu proyecto
firebase deploy --only extensions --project=projectId_or_alias