用于定期付款的 Paypal 订阅 webhook

Paypal subscription webhook for recurring payment

我已经设置了 Paypal webhooks 来跟踪经常性付款。我已经为

设置了 webhook
  1. BILLING.SUBSCRIPTION.UPDATED
  2. BILLING.SUBSCRIPTION.RE-激活
  3. BILLING.SUBSCRIPTION.RE新的
  4. BILLING.SUBSCRIPTION.CANCELLED
  5. BILLING.SUBSCRIPTION.EXPIRED
  6. BILLING.SUBSCRIPTION.SUSPENDED
  7. BILLING.SUBSCRIPTION.PAYMENT.FAILED
  8. BILLING.SUBSCRIPTION.ACTIVATED

除了激活之外,我没有收到任何事件。谁能帮我找出我需要设置的钩子来跟踪经常性订阅账单的交易?

谢谢

https://developer.paypal.com/docs/integration/direct/webhooks/event-names/#subscriptions

看来你想要PAYMENT.SALE.COMPLETED

还有一个是退款退回的

在 webhook 模拟器中 PAYMENT.SALE.COMPLETED 未完全显示,但在订阅付款时使用是正确的。它还有一个 subscription_id(由于某种原因它称为 billing_agreement_id)。

{
    "id": "WH-528005538C798144N-7H391362AP602264K",
    "create_time": "2021-04-17T22:45:35.950Z",
    "resource_type": "sale",
    "event_type": "PAYMENT.SALE.COMPLETED",
    "summary": "Payment completed for CAD 14.55 CAD",
    "resource": {
        "billing_agreement_id": "I-37B4TLL0FAJJ",
        "amount": {
            "total": "14.55",
            "currency": "CAD",
            "details": {
                "subtotal": "14.55"
            }
        },
        "payment_mode": "INSTANT_TRANSFER",
        "update_time": "2021-04-17T22:44:02Z",
        "create_time": "2021-04-17T22:44:02Z",
        "protection_eligibility_type": "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE",
        "transaction_fee": {
            "currency": "CAD",
            "value": "0.72"
        },
        "protection_eligibility": "ELIGIBLE",
        "links": [
            {
                "method": "GET",
                "rel": "self",
                "href": "https://api.sandbox.paypal.com/v1/payments/sale/44P499886K055384U"
            },
            {
                "method": "POST",
                "rel": "refund",
                "href": "https://api.sandbox.paypal.com/v1/payments/sale/44P499886K055384U/refund"
            }
        ],
        "id": "44P499886K055384U",
        "state": "completed",
        "invoice_number": ""
    },
    "status": "PENDING",
    "transmissions": [
        {
            "webhook_url": "https://webhook.site/7ece4e68-de87-46df-a341-5d3dc580efe6",
            "transmission_id": "b02ef980-9fce-11eb-b0ec-5bc241fbaaf3",
            "status": "PENDING"
        }
    ],
    "links": [
        {
            "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-528005538C798144N-7H391362AP602264K",
            "rel": "self",
            "method": "GET",
            "encType": "application/json"
        },
        {
            "href": "https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-528005538C798144N-7H391362AP602264K/resend",
            "rel": "resend",
            "method": "POST",
            "encType": "application/json"
        }
    ],
    "event_version": "1.0"
}