PayPal沙盒取消Webhook无法正常工作

发布于 2025-02-13 00:05:15 字数 4094 浏览 1 评论 0原文

订阅激活计费的网络曲目。Subscription。

但是,当我试图从客户沙箱帐户中取消订阅时,未收到Webhook帖子。

它应该是计费。

实际上,状态是从沙盒管理帐户中“待处理”:

它是否要等到订阅的结束日期才能发送取消? 还是出于安全原因等待几个小时?

以下是PayPal沙盒网站的详细信息:

{
    "id": "WH-3BV96304FY002321K-38Y64104YL460680C",
    "create_time": "2022-07-04T17:51:34.874Z",
    "resource_type": "subscription",
    "event_type": "BILLING.SUBSCRIPTION.CANCELLED",
    "summary": "Subscription cancelled",
    "resource": {
        "quantity": "1",
        "subscriber": {
            "email_address": "[email protected]",
            "payer_id": "X3FWGFE2SAXUL",
            "name": {
                "given_name": "Anyname",
                "surname": "Walker"
            },
            "shipping_address": {
                "address": {
                    "address_line_1": "Great st 25",
                    "admin_area_2": "New York",
                    "admin_area_1": "NY",
                    "postal_code": "10002",
                    "country_code": "US"
                }
            }
        },
        "create_time": "2022-07-04T17:49:00Z",
        "plan_overridden": false,
        "shipping_amount": {
            "currency_code": "USD",
            "value": "0.0"
        },
        "start_time": "2022-07-04T17:46:51Z",
        "update_time": "2022-07-04T17:51:25Z",
        "billing_info": {
            "outstanding_balance": {
                "currency_code": "USD",
                "value": "0.0"
            },
            "cycle_executions": [
                {
                    "tenure_type": "REGULAR",
                    "sequence": 1,
                    "cycles_completed": 1,
                    "cycles_remaining": 0,
                    "current_pricing_scheme_version": 1,
                    "total_cycles": 0
                }
            ],
            "last_payment": {
                "amount": {
                    "currency_code": "USD",
                    "value": "3.99"
                },
                "time": "2022-07-04T17:49:01Z"
            },
            "failed_payments_count": 0
        },
        "links": [
            {
                "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-6BR7NSX98KLF",
                "rel": "self",
                "method": "GET",
                "encType": "application/json"
            }
        ],
        "id": "I-6BR7NSX98KLF",
        "plan_id": "P-5XR3459593FMK2CYGA",
        "status": "CANCELLED",
        "status_update_time": "2022-07-04T17:51:25Z"
    },
    "status": "PENDING",
    "transmissions": [
        {
            "webhook_url": "https://www.myapp.com/webhook",
            "http_status": 440,
            "reason_phrase": "HTTP/1.1 200 Connection established",
            "response_headers": {
                "Server": "gunicorn",
                "Connection": "keep-alive",
                "Content-Length": "5",
                "Date": "Mon, 04 Jul 2022 18:15:52 GMT",
                "Content-Type": "text/html; charset=utf-8",
                "Via": "1.1 google"
            },
            "transmission_id": "02cba350-fbc2-9abc-d537a3be4540",
            "status": "PENDING",
            "timestamp": "2022-07-04T17:52:03Z"
        }
    ],
    "links": [
        {
            "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-3BV96304FY002321K-38Y64104YL460680C",
            "rel": "self",
            "method": "GET",
            "encType": "application/json"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-3BV96304FY002321K-38Y64104YL460680C/resend",
            "rel": "resend",
            "method": "POST",
            "encType": "application/json"
        }
    ],
    "event_version": "1.0",
    "resource_version": "2.0"
}

The webhook for a subscription activation BILLING.SUBSCRIPTION.ACTIVATED in the Paypal's sandbox works very well.

Nevertheless, when I'm trying to cancel the subscription from a customer sandbox account, no webhook post is received.

It should be BILLING.SUBSCRIPTION.CANCELLED.

In fact, the status is "pending" from the sandbox admin account:
enter image description here

Does it wait until the subscription's end date in order to send the cancellation?
Or does it wait a few hours for safety reasons?

Here are the details from the paypal sandbox web site:

{
    "id": "WH-3BV96304FY002321K-38Y64104YL460680C",
    "create_time": "2022-07-04T17:51:34.874Z",
    "resource_type": "subscription",
    "event_type": "BILLING.SUBSCRIPTION.CANCELLED",
    "summary": "Subscription cancelled",
    "resource": {
        "quantity": "1",
        "subscriber": {
            "email_address": "[email protected]",
            "payer_id": "X3FWGFE2SAXUL",
            "name": {
                "given_name": "Anyname",
                "surname": "Walker"
            },
            "shipping_address": {
                "address": {
                    "address_line_1": "Great st 25",
                    "admin_area_2": "New York",
                    "admin_area_1": "NY",
                    "postal_code": "10002",
                    "country_code": "US"
                }
            }
        },
        "create_time": "2022-07-04T17:49:00Z",
        "plan_overridden": false,
        "shipping_amount": {
            "currency_code": "USD",
            "value": "0.0"
        },
        "start_time": "2022-07-04T17:46:51Z",
        "update_time": "2022-07-04T17:51:25Z",
        "billing_info": {
            "outstanding_balance": {
                "currency_code": "USD",
                "value": "0.0"
            },
            "cycle_executions": [
                {
                    "tenure_type": "REGULAR",
                    "sequence": 1,
                    "cycles_completed": 1,
                    "cycles_remaining": 0,
                    "current_pricing_scheme_version": 1,
                    "total_cycles": 0
                }
            ],
            "last_payment": {
                "amount": {
                    "currency_code": "USD",
                    "value": "3.99"
                },
                "time": "2022-07-04T17:49:01Z"
            },
            "failed_payments_count": 0
        },
        "links": [
            {
                "href": "https://api.sandbox.paypal.com/v1/billing/subscriptions/I-6BR7NSX98KLF",
                "rel": "self",
                "method": "GET",
                "encType": "application/json"
            }
        ],
        "id": "I-6BR7NSX98KLF",
        "plan_id": "P-5XR3459593FMK2CYGA",
        "status": "CANCELLED",
        "status_update_time": "2022-07-04T17:51:25Z"
    },
    "status": "PENDING",
    "transmissions": [
        {
            "webhook_url": "https://www.myapp.com/webhook",
            "http_status": 440,
            "reason_phrase": "HTTP/1.1 200 Connection established",
            "response_headers": {
                "Server": "gunicorn",
                "Connection": "keep-alive",
                "Content-Length": "5",
                "Date": "Mon, 04 Jul 2022 18:15:52 GMT",
                "Content-Type": "text/html; charset=utf-8",
                "Via": "1.1 google"
            },
            "transmission_id": "02cba350-fbc2-9abc-d537a3be4540",
            "status": "PENDING",
            "timestamp": "2022-07-04T17:52:03Z"
        }
    ],
    "links": [
        {
            "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-3BV96304FY002321K-38Y64104YL460680C",
            "rel": "self",
            "method": "GET",
            "encType": "application/json"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-3BV96304FY002321K-38Y64104YL460680C/resend",
            "rel": "resend",
            "method": "POST",
            "encType": "application/json"
        }
    ],
    "event_version": "1.0",
    "resource_version": "2.0"
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挖鼻大婶 2025-02-20 00:05:15

待定意味着要待交付给订阅的Webhook URL。该事件已尝试,并尝试将其传递到URL,但是该URL并未以HTTP 200成功的消息响应,以确保Webhook已成功交付。实际上,根据您的问题记录的详细信息:

        "webhook_url": "https://www.myapp.com/webhook",
        "http_status": 440,

假设URL正确,并且您将其更改为“ myApp”,则用HTTP 440状态响应了

URL,因此您需要调试端点/端点/该网址处的代码,以便在将Webhook交付发布到它时具有200个成功状态。那么他们的身份将不再悬而未决。

Pending means pending delivery to the subscribed webhook URL. The event ocurred, and delivery to the URL was attempted, but that URL did not respond with an HTTP 200 success message for the webhook to be marked as successfully delivered. In fact, according to the details logged in your question:

        "webhook_url": "https://www.myapp.com/webhook",
        "http_status": 440,

That URL instead responded with an HTTP 440 status

Assuming the URL is correct and that you changed it to "myapp" for this question, the issue is that you need to debug the endpoint/code at that URL so that it responds with a 200 success status when webhook deliveries are posted to it. Then their status will stop being Pending.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文