> ## Documentation Index
> Fetch the complete documentation index at: https://primer.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up payment updates

Payments have a lifecycle. Primer has simplified learning payments and standardized the payment lifecycle for all processors. This way, you only need to rationalize about payments once.

You can learn more about Primer's payment lifecycle [here](/concepts/payment-lifecycle).

<Frame caption="Primer's payment lifecycle">
  <img src="https://goat-assets.production.core.primer.io/marketing/external-docs/getting-started/payment-updates/payment-lifecycle.png" />
</Frame>

As the payment is processed and goes through its lifecycle, you can get updates on the payment's state in two ways:

<CardGroup>
  <Card title="Universal Checkout events" icon="cart-shopping" href="#universal-checkout-events">
    Update your frontend UI with callbacks via the Primer SDK.
  </Card>

  <Card title="Payment webhooks" icon="credit-card" href="#payment-webhooks">
    Receive payment notification events directly to your server.
  </Card>
</CardGroup>

## Universal Checkout events

The [Primer SDK](/sdk/web/v2.x.x/installation) has various event callbacks you can listen to. These callbacks include `onCheckoutComplete()` and `onPaymentMethodAction()`. These are useful for updating the UI of your application, for example, to show loading indicators, success screens or failure screens.

However, as these are client-side, it's not the best practice to rely on these callbacks as the single source of truth. For this, it's recommended to rely on payment webhooks.

## Payment webhooks

Primer can also send [webhook](/api-reference/get-started/configure-webhooks) notification events to your server. These should be used to update the status of the payment on your server. See more details about the expected webhook payloads in our [API reference](/api-reference/endpoints/v2.4/payment-webhooks/payment-status-update).

### Handle the Payment's Lifecycle

All Primer payments conform to a [unified payment lifecycle](/concepts/payment-lifecycle). Each payment will progress through some combination of the [payment statuses](/concepts/payment-lifecycle) on their way through your workflow.
