问题描述
我正在尝试通过简单的付款方式来收到通知,但是我没有收到来自贝宝的指定URL的任何请求.这是我所做的:
I'm trying to get notified via webhooks when a simple payment is made, however I don't receive any request from paypal on the specified URL. Here is what I've done:
我有2个沙箱帐户:协调人和买方为主持人帐户创建一个应用程序(sanbox模式)在该应用中添加一个Webhook URL使用沙盒服务商用户名和密码登录sanbox.paypal.com生成包含测试产品的立即购买"按钮将按钮代码粘贴到我的页面上,然后使用sanbox买方帐户进行购买在开发人员仪表板中,如果我转至沙箱->通知:从测试买方收到的付款通知",则已收到付款,但是未调用服务器上的webhook页.我知道这一点,因为每次页面被调用时php脚本都会创建一个txt文件.另外,如果我转到开发者帐户-> Webhook通知"并选择该应用程序,我也会收到此消息:所选应用程序没有任何事件
I have 2 sandbox accounts: Facilitator and BuyerCreate an app (sanbox mode) for the facilitator accountAdd a webhook URL in that appLogin into sanbox.paypal.com with the sandbox facilitator username and passwordGenerate a buy now button with a test productPaste the button code on my page and make a purchase with the sanbox Buyer accountIn developer dashboard the payment is received if I go to Sandbox -> Notifications: "Notification of Payment Received from test buyer", but the webhook page on my server is not called. I know this because the php script creates a txt file every time the page is called. Also if I go to Developer Account -> Webhook Notifications and select the app I have this message: You don't have any events for the selected application
注意:如果我在webhook模拟器中添加URL,那么一切都会很好.
NOTE: If I add the URL in the webhook simulator everything works great.
我做错什么了吗?我必须将应用程序与立即购买"按钮连接起来吗?
Am I doing something wrong? Do I have to connect the app with the buy now button?
谢谢
我正在使用API REST.
I am using API REST.
推荐答案
Webhooks模拟器对事件的工作方式与实际的Webhooks交付方式不同.
The way Webhooks simulator works for an event is different from the actual Webhooks delivery.
对于Webhooks模拟器,您不需要创建/配置Webhook.您只需要一个端点URL,模拟器就可以在该URL上发布您选择的事件的相应样本有效负载.
For a Webhooks simulator, you don't need to create/configure a webhook. Only thing you require is an endpoint URL where the simulator can post the corresponding sample payload for an event selected by you.
要使用模拟器,请按照以下步骤操作:
To use the simulator, follow these steps:
- 转到Webhooks模拟器页面. developer.paypal.com/developer/webhooksSimulator
- 如果尚未登录,请登录.
- 输入Webhooks URL.
- 从下拉列表中选择事件类型.
- 单击发送测试"按钮.
根据您的描述,您似乎正在完成Webhooks Simulator所需的所有工作,并由此获得通知.
From your description, looks like you are doing everything required for Webhooks Simulator and getting the notification via that.
要在沙盒或实时环境中使用Webhooks,请执行以下操作:
To use Webhooks in the Sandbox or Live environment, do the following:
- 转到我的REST应用"页面.
- 创建应用程序(如果尚未创建的话).
- 添加一个Webhook URL(可以注册的最大Webhook数量)是每个应用10个.
- 订阅感兴趣的事件类型.
- Go to the My REST apps page.
- Create an application if you haven't done so already.
- Add a webhook URL (the maximum number of webhooks you can registeris 10 per application).
- Subscribe to the event types of interest.
可能您错过了上面的第4步.您需要订阅要为其接收通知的事件类型.
Probably you are missing Step 4 above. You need to subscribe to event type for which you want to get notifications.
这篇关于未收到Paypal Webhook通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!