- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试实现 Paypal 订阅流程用户点击 Paypal 订阅按钮我通过仪表板创建的。
在后端,我听PAYMENT.SALE.COMPLETED
订阅计费成功时触发的 webhook。不幸的是,webhook 并没有向我发送太多信息,因此我可以在我的数据库中检索与刚刚计费的订阅相关联的用户和项目。
这将允许我 安全地显示私有(private)内容 给那个用户。
这里是 webhook 内容 由 payPal 发送(对不起,长度):
const response = {
id: 'WH-4W487015EX264720U-32N35125TV248784B',
event_version: '1.0',
create_time: '2021-04-26T08:24:41.436Z',
resource_type: 'sale',
event_type: 'PAYMENT.SALE.COMPLETED',
summary: 'Payment completed for EUR 6.9 EUR',
resource: {
billing_agreement_id: 'I-T2HP99MJTS1T',
amount: {
total: '6.90',
currency: 'EUR',
details: {
subtotal: '6.90'
}
},
payment_mode: 'INSTANT_TRANSFER',
update_time: '2021-04-26T08:23:59Z',
create_time: '2021-04-26T08:23:59Z',
protection_eligibility_type: 'ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE',
transaction_fee: {
currency: 'EUR',
value: '0.48'
},
protection_eligibility: 'ELIGIBLE',
links: [
{
method: 'GET',
rel: 'self',
href: 'https://api.sandbox.paypal.com/v1/payments/sale/6R7481343K8159132'
},
{
method: 'POST',
rel: 'refund',
href: 'https://api.sandbox.paypal.com/v1/payments/sale/6R7481343K8159132/refund'
}
],
id: '6R7481343K8159132',
state: 'completed',
invoice_number: ''
},
links: [
{
href: 'https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-4W487015EX264720U-32N35125TV248784B',
rel: 'self',
method: 'GET'
},
{
href: 'https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-4W487015EX264720U-32N35125TV248784B/resend',
rel: 'resend',
method: 'POST'
}
],
}
我试过
GET
/v1/payments/sale/:id
但它并没有给我带来太多信息。
最佳答案
我们终于找到了解决方法 让我们的后端检索买家和商品。
前端
在订阅按钮代码上,经过大量试验/错误后,我们注意到 createSubscription
方法接受 promise ,我们可以使用它在付款继续之前将订阅 ID 发送到后端:
paypal.Buttons({
style: {...},
createSubscription: function (data, actions) {
return actions.subscription.create({
/* Creates the subscription */
plan_id: 'P-26J60279VA924454WMCBPBSA',
}).then(subscriptionId => { // subscriptionId == I-9DH5L3A3JAEB
return new Promise((res, rej) => {
// here we send the subscriptionId to the back-end
// and create a pending subscription
const body = {subscriptionId, userId, itemId};
apiCall('POST', '/subscription', body,() => {
// allow to return subscriptionId to paypal
resolve(subscriptionId);
})
});
});
},
onApprove: function (data, actions) {
// this function was of NO USE
// it is not safe to call your backend here
// as connexion can close and paypal doesn't
// wait after this function to capture payment
// thus leading to orphaned subscriptions
// (paid but not linked to your backend)
},
}).render('#paypal-button');
后端(webhook 处理程序)
webhookResponse.resource.billing_agreement_id
是订阅 ID 并允许验证先前创建的订阅。我不太明白为什么
billing_agreement_id
未命名
subscrition_id
...
关于javascript - 如何通过 webhook 在 PayPal API 中确认每月订阅的计费?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67270378/
今天早上,我收到以下消息“此帐户位于已弃用的计费系统上。请联系支持人员将其移至新系统。”当我在门户中打开订阅 Blade 时。当我尝试提交计费支持票证时,它只是在尝试提出支持计划时挂起,无论如何,这对
我正在尝试按照此 firebase 教程设置系统以在超出配额时禁用计费。 https://www.youtube.com/watch?v=Dk3VvRSrQIY 视频描述中链接的文档建议可以延迟终止开
Azure 中是否有办法根据资源组成员身份获取 2 个(或更多)在同一订阅下创建的资源消耗的单独发票?示例: 资源组 A - 包含 Sql 数据库 - 1 张发票 资源组 B - 具有应用服务 - 第
美好的一天。 我是 Azure 云新手,正在尝试了解不同的服务。 我们有 FileShare 存储帐户,该帐户安装在创建的 VM 上。存储帐户是否会默认启用 Azure Defender?我问这个问题
美好的一天。 我是 Azure 云新手,正在尝试了解不同的服务。 我们有 FileShare 存储帐户,该帐户安装在创建的 VM 上。存储帐户是否会默认启用 Azure Defender?我问这个问题
我正在尝试购买测试项目 ID“android.test.purchased”,以检查我的账单集成。但是出现如下错误: com.android.vending.api.ApiException: Err
我有一个带有应用内结算功能的安卓应用。我想要订阅。我看到一个谷歌示例。我在我的申请中介绍了计费。我购买一件商品。但我有问题。我单击按钮“购买”开始 Intent ...。关闭此 Intent 后(文本
默认情况下有多少个前端池附带 ASEv2? 前端池是否包含在 ASEv2 固定月费中?是否根据 worker 的数量和级别(I1、I2、I、3)收费?即 1x I1 前端 + 1x I1 工作人员 =
我们最近开始了新的 Azure DevOps 环境之旅。我确实需要 Microsoft 托管代理和即用即付并行作业的详细计费文档。Microsoft 托管代理相对于自托管代理有哪些优势以及这一切的成本
我们最近开始了新的 Azure DevOps 环境之旅。我确实需要 Microsoft 托管代理和即用即付并行作业的详细计费文档。Microsoft 托管代理相对于自托管代理有哪些优势以及这一切的成本
我正在制作一个应用程序,它可以存储用户使用我的应用程序学习了多少分钟。我的 Firestore 数据库以“用户”集合开头,每个用户都有自己的文档,该文档由 Auth 中生成的用户 ID 命名。 我的问
我需要与 Windows Azure 服务总线主题计费相关的详细信息。例如。 我需要为我的应用程序发布的内容或我的应用程序接收的内容付费吗? 例如。假设我有 1 个出版商和 5 个主题。每个主题每秒有
我正在使用 Azure 发票 API,它要求提供以下参数 https://management.azure.com/providers/Microsoft.Billing/billingAccount
在 Azure 的付款估算器上,我可以选择希望应用服务处于事件状态/付费的小时数。由于在办公时间之外或周末不需要我的应用程序,因此我可以减少工作时间,因此与支付 24/7 相比,成本估算会大大减少。因
我正在尝试对 SQL Azure 的计费术语进行一些澄清...我们目前有一个内部 SQL Server (2008),我们可以从中运行多个数据库。 SQL Azure 计费文档根据数据库大小列出了价格
知道 Azure 计费 API 是否依赖于部署模型(RM 或经典?)。这 Azure documentation没有提及任何具体内容。 最佳答案 两者都不是。部署模型与您配置的 Azure资源相关。计
我想在 Azure DevOps 组织超过一定阈值后删除其计费,以免他们被多收费。所以我有两个问题。首先,是否可以通过 Azure 门户上的成本管理/计费来确定特定 Azure DevOps 组织的预
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: This version of the application is not configured for
我正在尝试在我的一个应用程序中将诺基亚集成到应用程序购买中。我能够在诺基亚 X 模拟器上运行它。但是当我尝试在诺基亚 X 设备上执行相同的代码时,我遇到了以下问题。 我尝试为诺基亚商店应用清除数据,但
我正在开发一个 android 项目,我正在尝试实现 In App Billing V3。 我已将我的应用上传到 Google Play,并向该应用添加 IAP。我可以成功检索我的应用程序具有的 IA
我是一名优秀的程序员,十分优秀!