Git Product home page Git Product logo

firebase-extension's Introduction

Make Payments with Google Pay

Author: Google Pay (https://developers.google.com/pay/api)

Description: Makes a payment with Google Pay via one or more supported Payment Service Providers, and writes the response to Cloud Firestore.

Details: 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:

  • Adyen

    {
        "environment": "",
        "merchantAccount": ""
    }
    
  • Braintree

    {
        "environment": "Sandbox",
        "merchantId": "",
        "publicKey": ""
    }
    
  • Checkout.com

    {
        "publicKey": ""
    }
    
  • Cybersource

    {
        "authenticationType": "",
        "runEnvironment": "",
        "merchantID": "",
        "merchantKeyId": ""
    }
    
  • Square

    {
        "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 no-cost 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.

Configuration Parameters:

  • Cloud Functions location: Where do you want to deploy the functions created for this extension? You usually want a location close to your database. Realtime Database instances are located in us-central1. For help selecting a location, refer to the location selection guide.

  • Cloud Firestore path: What is the path to the Cloud Firestore collection you want to use for payment requests? You make payment requests by adding documents to this collection; the response will be written back to the same document.

  • Adyen Config: If you will use Adyen as a payment processor, specify your account information as a JSON object.

  • Adyen API Key: If you will use Adyen as a payment processor, specify your Adyen API key.

  • Braintree Config: If you will use Braintree as a payment processor, specify your account information as a JSON object.

  • Braintree Private Key: If you will use Braintree as a payment processor, specify your Braintree private key.

  • Checkout.com Config: If you will use Checkout.com as a payment processor, specify your account information as a JSON object.

  • Checkout.com Secret Key: If you will use Checkout.com as a payment processor, specify your Checkout.com secret key.

  • Cybersource Config: If you will use Cybersource as a payment processor, specify your account information as a JSON object.

  • Cybersource Secret Key: If you will use Cybersource as a payment processor, specify your Cybersource secret key.

  • Square Config: If you will use Square as a payment processor, specify your account information as a JSON object.

  • Square Access token: If you will use Square as a payment processor, specify your Square access token.

Access Required:

This extension will operate with the following project IAM roles:

  • datastore.user (Reason: Allows this extension to access Cloud Firestore to read and process added payment documents.)

firebase-extension's People

Contributors

stephenmcd avatar i14h avatar thatfiredev avatar tjlav5 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.