📜  square webhook payment.update 类型 (1)

📅  最后修改于: 2023-12-03 14:47:41.323000             🧑  作者: Mango

Square Webhook: payment.update

The payment.update webhook type is a crucial event in the Square payment processing system. This webhook is triggered whenever there is an update or change in the status or details of a payment. As a programmer, you can utilize this webhook to receive real-time updates on payment-related events, such as payment completion, refunds, or cancellations.

Payload Example

{
  "event_type": "PAYMENT_UPDATED",
  "event_id": "d0ac82e2-1d27-4354-aabd-8034c4b24dba",
  "created_at": "2022-08-15T10:30:45.000Z",
  "data": {
    "object": {
      "id": "B7Q9NHWBDB7XMLA4Q9D",
      "type": "PAYMENT",
      "created_at": "2022-08-15T10:30:26.000Z",
      "updated_at": "2022-08-15T10:30:43.000Z",
      "status": "COMPLETED",
      "amount_money": {
        "amount": 2500,
        "currency": "USD"
      },
      "location_id": "03CRRGKTBDJ4DJGZ7PS8C6EMK3",
      "order_id": "B2ILJV7TLQJ6M",
      "source_type": "CARD",
      "card_details": {
        "status": "CAPTURED",
        "card": {
          "card_brand": "VISA",
          "last_4": "4242"
        }
      }
    }
  }
}

Event Details

The payment.update webhook event provides you with important information related to the payment update. This includes:

  • event_type: Indicates the type of event, which in this case is PAYMENT_UPDATED.
  • event_id: A unique identifier for the event.
  • created_at: The timestamp when the event occurred.

Payment Information

The webhook payload also contains detailed information about the updated payment. Some key attributes include:

  • id: The unique ID of the payment.
  • type: Specifies the type of payment.
  • created_at and updated_at: Timestamps indicating the creation and update times.
  • status: The updated status of the payment (e.g., COMPLETED, PENDING, or CANCELED).
  • amount_money: The amount and currency of the payment.
  • location_id: The ID of the Square location where the payment occurred.
  • order_id: The ID of the associated order, if applicable.
  • source_type: Indicates the payment source type (e.g., CARD, CASH, EXTERNAL, or GIFT_CARD).
  • card_details: Details specific to card payments, including the card brand and last 4 digits.

You can leverage this information to update your internal systems, trigger additional actions, or keep track of payment-related activities.

Ensure that you handle the Square webhook payload securely by verifying the webhook signature and processing the data accordingly.

For more details on the Square payment.update webhook, refer to the Square Developer Documentation.