INFRA

Vue.js + Firebase + Stripeで開発しているときに調べたことのメモ

CloudFunctions

  • async/await使う時は、下記のようにnode:8をpackage.jsonに設定する必要ある。
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"engines": {"node": "8"},

上記を設定すると、そのままだとyarnが使えなかった。ココに書いてある、下記をやると使えるようになった。

$ yarn add hoge --ignore-engines
  • あと、FirebaseのSparkプランだと、functionsはgoogle以外に繋げないので、stripeとか使う場合は、開発段階で、Blazeプランとかにする必要がある。Blazeプランにして無料枠内で開発すれば大丈夫。

https://firebase.google.com/pricing/?authuser=0firebase.google.com

Stripe + Vue.js

  • 下記を使ってStripe ElementのUIを簡単に表示できた。

https://github.com/fromAtoB/vue-stripe-elementsgithub.com

  • Elementでtokenをつくって、token.idをfunctionsの関数に渡して、functionsの関数で、stripeとつなげて、customer作ったりする。