---
title: "Payment Webhook Handler"
method: POST
path: "/api/v1/wallet/payment-webhook"
tags: ["Wallet"]
---

# Payment Webhook Handler

`POST /api/v1/wallet/payment-webhook`

## Request

- Base URL: `https://backend.caspr.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://backend.caspr.ai/api/v1/wallet/payment-webhook`
- Auth: none declared

Credit tokens to a user's wallet from a completed payment (called by payment service).

## Headers

- `X-API-Key` string, nullable

## Request body

- PaymentWebhookRequest: Request to credit tokens from a payment.
  - `payment_id` string, required
  - `status` string, required
  - `amount` number, nullable
  - `currency` string, nullable
  - `payment_method` string, nullable
  - `payment_method_details` object, nullable

## Response `200`

Successful Response

- PaymentWebhookResponse: Response for credit from payment.
  - `success` boolean
  - `tokens_credited` integer, nullable
  - `batch_id` string, nullable
  - `balance_after` integer, nullable
  - `message` string, nullable
  - `idempotent` boolean

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `422`: Validation Error
- `500`: Internal Server Error

---

[API](https://skmtc.dev/caspr/apis/casper-api.md) - [All operations](https://skmtc.dev/caspr/apis/casper-api/llms.txt) - [OpenAPI document](https://skmtc.dev/caspr/apis/casper-api/revisions/f9765e3aa00c?raw)
