Node-1st-gen/coupon-on-purchase/README.md
This sample shows how to send a coupon to your users who have just purchased something. For instance: 10% off on your next purchase!
See file functions/index.js for the trigger and the FCM code.
The function assumes that you are setting the Firebase Analytics User ID to be the same as the Firebase Auth uid using the setUserId API. Also it is assumed that the FCM Device Tokens need to be saved in the Firebase Realtime Database under /users/$uid/tokens.
The dependencies are listed in functions/package.json.
The function triggers on changes to in_app_purchase Firebase Analytics events. For other automatically logged events see: https://support.google.com/firebase/answer/6317485
This sample can be tested on your Android and iOS app. To test it out:
firebase use --add then select your projec tin the list.firebase deployin_app_purchase event (somehow).