> For the complete documentation index, see [llms.txt](https://docs.coda.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coda.co/codapay/recurring-payments/initiate-payment-account-binding/payment-method-webhook-events.md).

# Payment Method Webhook Events

This reference describes how to receive and process server-to-server webhook notifications from Codapay. These notifications keep your backend synchronized with the transaction status as a user progresses through the payment flow.

### Overview

Codapay uses webhooks to notify your "Complete Notification URL" whenever a transaction reaches a final state or a critical milestone.

{% hint style="info" %}
Ensure your "Complete Notification URL" is configured in the Publisher Portal. Refer to the [Set up payments](/codapay/getting-started/set-up-payments.md) guide for detailed instructions.
{% endhint %}

### Event Types

For Codapay integrations, your endpoint should be prepared to handle the following `eventType` values:

| Event Type               | Type                                                         | Description                                          |
| ------------------------ | ------------------------------------------------------------ | ---------------------------------------------------- |
| `PAYMENT_METHOD_ADDED`   | [Payment Method notification](#payment-method-notifications) | The shopper successfully saved a new payment method. |
| `PAYMENT_METHOD_REMOVED` | [Payment Method notification](#payment-method-notifications) | The shopper removed a saved payment method.          |

### Notification Payload Structure

Notifications are sent as a `POST` request with a JSON body. Each type of notification has a specific structure and content.

#### Payment Method Notifications

<table><thead><tr><th width="185.33203125">Field</th><th width="117.671875">Type</th><th>Description</th></tr></thead><tbody><tr><td>eventType</td><td>string</td><td>The specific event type being reported (e.g., <code>PAYMENT_METHOD_ADDED</code>)</td></tr><tr><td>timestamp</td><td>string</td><td>The timestamp of when the event occurred</td></tr><tr><td>shopper</td><td>object</td><td>An object containing shopper details such as ID, email, or partner-specific identifiers.</td></tr><tr><td>paymentMethod</td><td>object</td><td>Information regarding the payment instrument used (e.g., token, card type, last four digits).</td></tr></tbody></table>

**PAYMENT\_METHOD\_ADDED**

This notification is sent when a new card is successfully saved and linked to the shopper profile.

**Notification Payload**

```json
{
  "eventType": "PAYMENT_METHOD_ADDED",
  "timestamp": "2025-06-19T02:48:39.568907Z",
  "shopper": {
    "id": "shp_sg197861636b40021",
    "partner_shopper_id": "test_partner_123_Id",
    "email": "test@example.com"
  },
  "paymentMethod": {
    "id": "pmt_sg1000616a1900024",
    "type": "card",
    "card": {
      "lastFour": "7263",
      "expirationMonth": "04",
      "expirationYear": "2027"
    }
  }
}
```

### Responding to Notifications

To acknowledge receipt of the notification, your server must respond with a `200 OK` and the following JSON body:

```json
{
  "ResultCode": 0
}
```

Retry Policy If no valid response is received, Codapay will re-send the notification 3 times at 5-minute intervals. If all attempts fail, an email alert will be triggered to your technical contact.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.coda.co/codapay/recurring-payments/initiate-payment-account-binding/payment-method-webhook-events.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
