2

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

  1. 计费.订阅.更新
  2. 计费.订阅.重新激活
  3. 计费.订阅.续订
  4. 计费.订阅.取消
  5. 计费.订阅.过期
  6. 计费.订阅.暂停
  7. 计费.订阅.支付.失败
  8. 计费.订阅.激活

除了激活之外,我没有收到任何事件。谁能帮我找出我需要设置的挂钩来跟踪定期订阅计费的交易?

谢谢

4

2 回答 2

2

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

看起来你想要PAYMENT.SALE.COMPLETED

还有一种用于退款和撤消。

于 2020-04-30T18:24:27.767 回答
1

在 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"
}
于 2021-04-17T21:56:54.973 回答