EvOlaNdLuPiZ
EvOlaNdLuPiZ

Reputation: 600

Is there integration between Square and Firebase?

Background Information

Square recently released SquareSDK.

Firebase has compatibility with StripeSDK.

Questions

Does Firebase have compatibility with Square?

Is there support that allows for integration?

I've gone through the preliminaries for Square and i've noticed in their sample application which has a walkthrough, in specific, their sample code allows us to replace the charge server, can I replace this with firebase hosting?

Sample Code

Square Cookie Demo, code for setting charge server in "take" payments guide:

private static final String CHARGE_SERVER_HOST = "REPLACE_ME";
private static final String CHARGE_SERVER_URL = 
"https://" + CHARGE_SERVER_HOST + "/";

Firebase Stripe Demo, code for setting key in "process" payments guide:

firebase.initializeApp({
    apiKey: "your-web-api-key",
    authDomain: "your-firebase-project-id.firebaseapp.com",
    databaseURL: "https://your-firebase-project-id.firebaseio.com",
    storageBucket: "your-firebase-project-id.appspot.com",
    messagingSenderId: "your-cloud-messaging-sender-id"
  });
  Stripe.setPublishableKey('your-stripe-publishable-key');

Some Thoughts

From the walkthrough on Square cookie demo,

(1) sign up with square to gain an access key, for the purpose of communicating with their api through the app., [✓]

(2) sign up with heroku, for the purpose of deploying the app. and hosting the charge server, [✓]

(3) placing the key we got from square in the heroku account. [✓]

I'd imagine .setPublishableKey(...) is similar to this process?

(1) sign up with square to gain access key, [✓]

(2) sign up with firebase to gain hosting capabilities for the app., [✓]

(3) placing the key we got from square in the firebase account (through the CLI). [???]

Upvotes: 3

Views: 1626

Answers (1)

mootrichard
mootrichard

Reputation: 3611

Square does not have an official integration with Firebase, but is certainly compatible with Square.

You wouldn't be able to replace the Charge server with Firebase hosting, unless you were configuring specific Firebase hosting routes to point to Firebase Cloud functions that are processing your charges.

You'll see in the source code of Firestripe that they are creating a cloud function for processing the charge on the "backend".

As for the publishable key, that would be the equivalent in Square as your Application ID. That is used for identifying your payment form, which is used for generating the nonces that you pass to your backend for creating customer cards or directly for processing transactions.

Since it seems you're referencing the In-App Payments SDK, you can reference the backend server quickstart to see what a charge looks like. It should be fairly easy to refactor that into a cloud function.

Some additional reading:

Upvotes: 4

Related Questions