Stripe支付相关资料
1: API文档: https://stripe.com/docs/api
2:JS文档:https://stripe.com/docs/js
3:其他资料:https://blog.****.net/u011216417/article/details/80027965
https://blog.****.net/u012482647/article/details/98942190
https://blog.****.net/Java_Mrsun/article/details/88393871
https://www.cnblogs.com/doinbean/p/9320162.html
以下是stripe前端开发步骤:
国外三大支付paypal,braintree,stripe,有兴趣可以去了解一下他们的区别。
支付宝和paypal基本只需要发送charge信息请求交给后端做就ok了,那么stripe前端也只需要收集卡信息,拿到token给后端就ok了。
那就来说说主角stripe支付:官方文档
stripe官方说分为六步,如下图:
step1: 收集卡信息 step2 :创建customer step3:支付金额
step4和step5:计划(月付和年付等)
step6:成功
其实相对于普遍来说 step4和step5不用考虑,所有我们就只有4步。
前端stripe支付步骤:
1:引入stripe.js(为了方便测试,简便引入stripe.js,引入axios为了测试退款请求)
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
2:接下来就是按照官方文档步骤走,粘贴复制,先创建页面收集卡信息。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|
3.创建stripe客户端,将stripe提供的卡页面内嵌到页面中,用于收集卡信息,然后监听form表单提交,阻止表单提交前先去给stripe交互。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
|
一些stripe提供的样式:stripe element examples 地址