【发布时间】:2021-01-31 14:13:43
【问题描述】:
我正在使用 Angular 创建一个项目。在我的项目中,我正在集成 square payment api 并使用 firebase 创建费用。我知道我们可以很容易地用这个服务器端实现,但我的要求是做无服务器。我已经集成了angular side square api,但是我不知道如何在没有服务器的情况下创建费用
cardNonceResponseReceived: function (errors, nonce, cardData) {
if (errors) {
// Log errors from nonce generation to the Javascript console
console.log("Encountered errors:");
errors.forEach(function(error) {
console.log(' ' + error.message);
});
return;
}
alert('Nonce received: ' + nonce); /* FOR TESTING ONLY */
// Assign the nonce value to the hidden form field
// document.getElementById('card-nonce').value = nonce;
//needs to be extracted from the
(<HTMLInputElement>document.getElementById('card-nonce')).value = nonce; //casting so .value will work
//get this value from the database when the user is logged in
(<HTMLInputElement>document.getElementById('sq-id')).value = "CBASEC8F-Phq5_pV7UNi64_kX_4gAQ";
// POST the nonce form to the payment processing page
(<HTMLFormElement>document.getElementById('nonce-form')).submit();
},
【问题讨论】:
-
无服务器没有任何意义。我想在有人付款后一定会发生一些事情。无论是注册谁支付或该人支付了什么。为什么还要付款?
标签: javascript angular firebase square