[英]iOS Firebase Stripe Integration w/ Cloud Functions, equivalent of push() and pushId in iOS
我正在使用Firebase雲功能來處理我的條紋付款。 我有一些設置正確。 用戶驗證后,它會自動創建一個帶區用戶。 效果很好。
在Firebase在“添加付款來源”下提供的示例內部顯示
exports.addPaymentSource = functions.database.ref('/stripe_customers/{userId}/sources/{pushId}/token').onWrite((event) =>
它應采用Stripe提供的支付令牌,並將其寫入實時數據庫,並使用該令牌為用戶更新Stripe。
但是,尚不清楚“ pushID”代表什么。 我已經進行了無數次嘗試
let payment: NSMutableDictionary = ["sources":"stripeCustomerID" ]
self.root.child("stripe_customers").child("FIREBASE USER ID").updateChildValues(payment as! [AnyHashable : Any])
但這似乎並不會觸發任何條紋。
有人知道如何構造此調用或推送ID是什么嗎?
Firebase示例中的評論說
通過將條帶化支付源令牌寫入實時數據庫來為用戶添加支付源(卡)
在Firebase中, pushId
表示您的數據庫的任何鍵名。 您可以使用childByAutoId()
設置唯一鍵
設置您的孩子的路徑,您想將其設置為自動推送ID。
let sourcesRef = root.child("stripe_customers").child("FIREBASE USER ID").child("sources")
sourcesRef.child(sourcesRef.childByAutoId().key).child("token").setValue("tokenValue")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.