Google 致力于为黑人社区推动种族平等。查看具体举措

使用 Google Pay 付款

Google Pay
Made by Google Pay

通过一个或多个支持的付款服务提供商使用 Google Pay 付款,并将响应写入 Cloud Firestore。

此扩展程序的运作方式

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.

如何安装此扩展程序

使用 Firebase 控制台

要安装和管理扩展程序,您可以使用 Firebase 控制台。

使用控制台安装

使用 Firebase CLI

要安装和管理扩展程序,您还可以使用 Firebase CLI:

步骤 1 :运行以下 npm 命令来安装 CLI 或将 CLI 更新到最新版本。

npm install -g firebase-tools
不能运行?请参阅 Firebase CLI 参考文档 或者更改您的 npm 权限

第 2 步 设置一个新的 Firebase 项目目录 或转到现有目录

第 3 步 :将此扩展程序添加到 扩展程序清单

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

第 5 步 :将清单中的扩展程序 部署 到项目中

firebase deploy --only extensions --project=projectId_or_alias
支持
Cloud Firestore
作者
许可
Apache-2.0
版本
0.1.3