【发布时间】:2021-08-08 05:51:01
【问题描述】:
伙计,我在这方面已经有几天了,但找不到一个好的解决方案。我想使用我的帐户(通过公钥和私钥)来促进从一个帐户到另一个帐户的付款(没有任何东西会进入我的帐户)。在前端我有:
checkout(amount) {
const strikeCheckout = (<any>window).StripeCheckout.configure({
key: environment.PRODUCTION==='true'?stripeLiveClientId:stripeTestClientId,
locale: 'auto',
token: (stripeToken: any) => {
if(stripeToken){
console.log(stripeToken)
this.createCharge(stripeToken,amount)
}
}
});
strikeCheckout.open({
name: 'Camel Stripe',
description: 'Stripe Checkout',
amount: amount
});
}
只是一个小片段,但本质上这只是捕获信用卡和电子邮件,并确保它是一张有效的信用卡,然后制作一个条带令牌。然后我将此令牌传递给节点后端并执行:
stripe.paymentIntents.create({
amount: priceInPence,
currency: 'usd',
source: stripeTokenId,
capture: false, // note that capture: false
}).then(charge => {
return res.json({ success: true, message: 'Success', result: charge })
}).catch(error => {
res.status(400).json({ success: false, status: 400, message: error });
});
//})
};
无论我如何构建它,它总是最终将付款发送到我的帐户,即具有公钥/私钥的帐户。有谁知道我可以使用这个令牌的方法,因为它有必要的信息,并将钱汇到另一个账户?
【问题讨论】:
标签: node.js angular stripe-payments payment-gateway