使用NGX-Stripe的订阅 [英] Subscription with ngx-stripe
本文介绍了使用NGX-Stripe的订阅的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有人知道或知道如何向我解释NGX-Stripe如何订阅。
我试着用Curl做,但做不到。
我可以制作令牌卡,但下一步是什么?
我的前端是带角的,后端是带棱角的。
我明白我需要制作令牌,然后是客户,最后是订阅。但我不知道怎么回事,我已经看过文档了,但还是卡住了
推荐答案
在条带中创建订阅的主要步骤如下:
- 创建条纹客户(条纹/收银员)
- 领用付款方式(NGX-Stripe)
- 将付款方式保存给客户(条码/收银员)
- 创建订阅(条带/收银台)
https://richnologies.gitbook.io/ngx-stripe/examples#create-token
但是,我不会调用this.stripeService.createToken
,而是调用this.stripeService.createPaymentMethod
:
this.stripeService
.createPaymentMethod({
type: 'card',
card: this.card.element,
billing_details: { name },
})
.subscribe((result) => {
if (result.paymentMethod) {
// Send the payment method to your server
console.log(result.paymentMethod.id);
} else if (result.error) {
// Error creating the token
console.log(result.error.message);
}
});
PaymentMethods是STRIPE用于收集付款详细信息的较新推荐路径。
在创建PaymentMethod之后,您需要将PaymentMethod ID发送到您的服务器。在您的服务器中,您将创建一个客户并将PaymentMethod保存到其中:使用条带
- https://stripe.com/docs/api/customers/create
- https://stripe.com/docs/api/customers/create#create_customer-invoice_settings-default_payment_method
使用Laravel收银机
在这一点上,您将拥有一位具有保存的PaymentMethod的STRIPE客户。最后一步是为该客户创建订阅:使用条带
使用Laravel收银机
这就是要点!
这篇关于使用NGX-Stripe的订阅的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文