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

# Verify Payment

> Verify a Razorpay payment signature after checkout completes.

Verify that a Razorpay payment completed successfully by submitting the order ID, payment ID, and signature returned by the Razorpay checkout flow. This endpoint does not require authentication.

## Request

**`POST /payments/verify`**

```http theme={null}
Content-Type: application/json
```

<ParamField body="orderId" type="string" required>
  The Razorpay order ID returned when the order was created (`POST /payments/order`).
</ParamField>

<ParamField body="paymentId" type="string" required>
  The Razorpay payment ID provided by Razorpay after the user completes checkout.
</ParamField>

<ParamField body="signature" type="string" required>
  The HMAC-SHA256 signature provided by Razorpay. Used to confirm the payment is authentic.
</ParamField>

<ParamField body="paymentMode" type="string">
  The payment mode used during checkout (e.g. `upi`, `card`). Optional.
</ParamField>

<Tip>
  Razorpay provides the `paymentId` and `signature` in the `handler` callback of the checkout SDK after the user completes payment on the client.
</Tip>

## Response

<ResponseField name="success" type="boolean">
  `true` if the signature is valid and the payment is verified; `false` otherwise.
</ResponseField>

<ResponseField name="message" type="string">
  A human-readable description of the verification result.
</ResponseField>

<Warning>
  Always verify the Razorpay signature server-side before marking a ride as paid or updating ride status. Never trust the result of client-side payment callbacks alone.
</Warning>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST http://localhost:8080/payments/verify \
    -H "Content-Type: application/json" \
    -d '{
      "orderId": "order_OmXy1234abcd",
      "paymentId": "pay_OmXy9876wxyz",
      "signature": "a3f1c2d4e5b6...",
      "paymentMode": "upi"
    }'
  ```

  ```json Response theme={null}
  {
    "success": true,
    "message": "Payment verified successfully."
  }
  ```
</CodeGroup>
