贝宝订阅网络挂钩的定期付款

时间:2020-04-30 16:37:33

标签: paypal paypal-rest-sdk paypal-subscriptions paypal-webhooks

我已经设置了Paypal网络挂钩来跟踪重复付款。我已经为

设置了webhook
  1. BILLING.SUBSCRIPTION.UPDATED
  2. 重新激活帐单。
  3. BILLING.SUBSCRIPTION.RENEWED
  4. BILLING.SUBSCRIPTION.CANCELLED
  5. BILLING.SUBSCRIPTION.EXPIRED
  6. BILLING.SUBSCRIPTION.SUSPENDED
  7. 结算,订阅,付款失败
  8. BILLING.SUBSCRIPTION.ACTIVATED

除了激活,我没有任何其他事件。有人可以帮助我找出为跟踪定期订阅结算交易而需要设置的挂钩吗?

谢谢

2 个答案:

答案 0 :(得分:0)

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

您似乎想PAYMENT.SALE.COMPLETED

还有一种可以退款和退款。

答案 1 :(得分:0)

在 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"
}