"verification_status":"FAILURE" 总是失败 - PayPal-Node-SDK
Posted
技术标签:
【中文标题】"verification_status":"FAILURE" 总是失败 - PayPal-Node-SDK【英文标题】:"verification_status":"FAILURE" always fails - PayPal-Node-SDK 【发布时间】:2020-09-26 18:42:53 【问题描述】:我一直在尝试集成 PAYMENT.SALE.COMPLETED 通知 webhook。 我在整个互联网上搜索,它总是失败并出现以下错误代码:“verification_status”:“FAILURE”,状态:
const verifyWebHook = (header, body, token, webhookId) =>
return new Promise((resolve, reject) =>
const VERIFY_URL = 'https://api.sandbox.paypal.com/v1/notifications/verify-webhook-signature';
const webhookObjJSON = '' +
'"auth_algo": "' + header['paypal-auth-algo'] + '"' +
',"cert_url": "' + header['paypal-cert-url'] + '"' +
',"transmission_id": "' + header['paypal-transmission-id'] + '"' +
',"transmission_sig": "' + header['paypal-transmission-sig'] + '"' +
',"transmission_time": "' + header['paypal-transmission-time'] + '"' +
',"webhook_id": "' + webhookId + '"' +
',"webhook_event": ' + JSON.stringify(body) +
'',
validationReqOptions =
method: 'POST',
uri: VERIFY_URL,
headers:
'Authorization': token,
'content-type': 'application/json'
,
body: webhookObjJSON,
rp(validationReqOptions)
.then((res) =>
return resolve(res)
)
.catch((err) =>
return reject(err);
);
)
rp 是 request-promise(尝试了几个 requests 模块)。
这是我的请求正文(webhookObjJSON 变量)
'
"auth_algo":"SHA256withRSA",
"cert_url":"https://api.paypal.com/v1/notifications/certs/CERT-360caa42-fca2a594-5edc0ebc",
"transmission_id":"9f1826f0-a941-11ea-b1e4-55afeaff811c",
"transmission_sig":"KxQVusuDV2ZtsjALJ/QXdo9L4voX3VmIWGMrAPbzi1phBIr4FEQz5nG6ANIkHKdOhgifO81UA2Y3ljHKQoe/8T8fozRwox+CSXAwxFVKZC63am0YjkzNDWB3DMxVQKnec8q2Yeha26gfssIG/x+lGnr+fmWAl+3OtxpS7rP7T7fckj53J+5aro1NNf+eHkqjZvAGponHJiPx8pZKXcF2aAXGzkcLB+V7FYjbOoW4QgksoyEMVZ9hqxseA/CWda9t43y+VER3xdtFqH+Z6Oyt5KZfRQ4rdAYqlU3iIgJl1RR/IiPi/YlglBqtY4HFBN9i7507uRF67cbh2hcgqIxZuQ==",
"transmission_time":"2020-06-08T04:36:29Z",
"webhook_id":"80021663DE681814L",
"webhook_event":
"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"
]
'
感谢您的帮助!
【问题讨论】:
转储生成的请求对象(标头和正文)的样本。 @PrestonPHX 嘿伙计,我刚刚编辑了我的问题,祝你有美好的一天! 【参考方案1】:您似乎正在尝试验证模拟器在 https://developer.paypal.com/docs/api-basics/notifications/webhooks/simulator/ 生成的模拟 webhook
正如该页面所述,“您无法验证模拟器生成的事件。”
【讨论】:
如何验证订阅付款?我必须等待一个月才能查看 webhook 是否正常工作? 在沙盒中创建 1 天周期,或在沙盒中验证一次性(非订阅)付款 我确实设法触发了沙盒上的事件(不是模拟)。我得到同样的错误。 使用该示例更新您的问题,并包含标头或沙箱客户端/秘密凭据,然后其他人可以看到问题所在以上是关于"verification_status":"FAILURE" 总是失败 - PayPal-Node-SDK的主要内容,如果未能解决你的问题,请参考以下文章
如何将 ["tag":"google","count":1,"tag":"microsoft",&q
"message":"请求失败,状态码 500","name":"Error","stack":&q
"errors":"errors":["detail":"您无权执行此操作。","code":&qu
"Navicat" , "mysql" , "xxx.war" , "tomcat",“JDK","