贝宝 webhook 响应保存到表

Posted

技术标签:

【中文标题】贝宝 webhook 响应保存到表【英文标题】:paypal webhook response save to table 【发布时间】:2022-01-13 04:19:54 【问题描述】:

我正在尝试从 paypal webhook 获取自动续订响应并保存到表格。 在模拟呼叫模拟器中,它显示无法验证 webhook。 我写了我得到的日志文件。正在使用 laravel 框架,如果有人可以提供帮助,那就太好了

 production.DEBUG: "id":"WH-2WR32451HC0233532-67976317FL4543714","event_version":"1.0","create_time":"2014-10-23T17:23:52Z","resource_type":"sale","event_type":"PAYMENT.SALE.COMPLETED","summary":"A successful sale payment was made for $ 0.48 USD","resource":"id":"80021663DE681814L","create_time":"2014-10-23T17:22:56Z","update_time":"2014-10-23T17:23:04Z","amount":"total":"0.48","currency":"USD","payment_mode":"ECHECK","state":"completed","protection_eligibility":"ELIGIBLE","protection_eligibility_type":"ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE","clearing_time":"2014-10-30T07:00:00Z","parent_payment":"PAY-1PA12106FU478450MKRETS4A","links":["href":"https://api.paypal.com/v1/payments/sale/80021663DE681814L","rel":"self","method":"GET","href":"https://api.paypal.com/v1/payments/sale/80021663DE681814L/refund","rel":"refund","method":"POST","href":"https://api.paypal.com/v1/payments/payment/PAY-1PA12106FU478450MKRETS4A","rel":"parent_payment","method":"GET"],"links":["href":"https://api.paypal.com/v1/notifications/webhooks-events/WH-2WR32451HC0233532-67976317FL4543714","rel":"self","method":"GET","href":"https://api.paypal.com/v1/notifications/webhooks-events/WH-2WR32451HC0233532-67976317FL4543714/resend","rel":"resend","method":"POST"]


    [2021-12-07 16:59:47] production.DEBUG: Array
    (
    production.DEBUG: PayPal\Api\VerifyWebhookSignatureResponse Object
    (
        [_propMap:PayPal\Common\PayPalModel:private] => Array
            (
                [verification_status] => FAILURE
            )
    
    )

我想从 webhook 响应中保存支付的用户、金额、时间、组等, 再次说明,这是订阅的自动续订,所以它会自动触发。

【问题讨论】:

【参考方案1】:

无法验证模拟 webhook。订阅沙盒环境中的 webhook 并在其中生成事件(如果您希望验证它们)。

【讨论】:

先生,它可以使用沙箱凭据吗?你有任何文件吗? PayPal webhook 文档位于 developer.paypal.com/docs/api-basics/notifications/webhooks/… 我从如何找到计划数据和用户数据的响应中获得了实时的交易 ID 和 bliing 协议 ID。 我正在现场尝试找出用户详细信息和计划名称。我得到了交易 ID 和账单 ID。先生请帮助@preston "error":"invalid_token","error_description":"令牌签名验证失败"

以上是关于贝宝 webhook 响应保存到表的主要内容,如果未能解决你的问题,请参考以下文章

无法在沙盒中测试付款撤销 webhook 事件。贝宝 REST API

PHP 验证 Paypal webhook 签名

Webhook 加上定期付款

Paypal webhook 而不是返回 url

HTTP 响应、Webhook 和 Json

Azure Function App 对 Webhook 的初始响应