# Razorpay Module

https://docs.wisecp.com/de/razorpay-module

Connect Razorpay to let clients pay through its checkout window while you follow invoice payments in WISECP.

## Reaching the Screen

Go to **Settings → Financial → Payment Gateways → All Modules** and click **RazorPay**: `{admin}/modules/payment?module=RazorPay`

## What Is on the Screen

The form contains an API key pair, a payment action and shared gateway settings. Razorpay supplies the payment window. The module offers no WISECP card storage, automatic renewal payments, subscriptions, installment configuration or gateway refunds.

## Before You Configure It

Use a Razorpay merchant account approved for the payment methods and currencies you need. Live keys require account activation and the relevant website approval. Start with test keys on a separate test system.

Keep the site on HTTPS and allow Razorpay's checkout script. There is no connection-test button. The module multiplies amounts by 100; do not assume it supports currencies with other decimal rules.

## Fields

- **Key Id**: Required; empty by default. Enter the test or live Key ID for the selected merchant account.
- **Key Secret**: Required; empty by default. Must belong to the same environment and key pair as Key Id.
- **Payment Action**: The form defaults to Authorize and Capture. Authorize requests authorization only. Explicitly save your choice and check Razorpay's capture settings.

There is no Test Mode switch; replace both keys to change environments. **Status** enables the module. Commission, conversion, limits and country lists are explained in [Payment Modules](https://docs.wisecp.com/en/payment-modules).

**Callback URL**, **Success URL** and **Failed URL** are generated addresses. The checkout form already sends its result to Callback URL.

## Tasks

### Configure the Keys

1. In Razorpay Dashboard, select test mode. Open **Account & Settings → Website and app settings → API Keys** and click **Generate Key**.
2. Save the Key ID and Key Secret securely; the secret is shown only when generated. In WISECP's RazorPay form, enable **Status** and enter both values.
3. Select **Payment Action → Authorize and Capture** and click **Save Changes**. Confirm automatic capture under Razorpay **Account & Settings → Payments Capture**.
4. In WISECP **Payment Gateways → Initial → Enabled Module Selection**, select RazorPay and click **Save Changes**. The method becomes available within its configured limits.

To change Razorpay capture settings, use **Change** beside **Automatic Capture**. Select your capture period, continue with **Next**, choose the refund handling and speed, then click **Save**. These settings affect the merchant account, including other integrations.

### Browser Return and Webhooks

This module checks the signed browser form response using the order stored in the client's session. Keep that session available until the payment returns.

This module does not accept Razorpay webhook notifications and has no webhook-secret field. Do not register its **Callback URL** as an `order.paid` webhook.

### Test and Switch to Live

1. Open an unpaid test invoice as its client, select RazorPay and open the Razorpay payment window.
2. Use [Razorpay's test payment details](https://razorpay.com/docs/payments/payment-gateway/web-integration/standard/integration-steps/). Complete the return without closing the window.
3. Verify **captured** in Razorpay and the paid invoice in WISECP, with matching amount and currency. Also check cancellation and an interrupted return.
4. After approval, generate live keys in Razorpay, replace both WISECP values and click **Save Changes**. Subsequent payments use real funds.

### Refund a Payment

1. In Razorpay **Transactions → Payments**, open the captured payment. In **Refund Payment**, enter the refund amount.
2. Choose whether to use **Refund Instantly**, reviewing its fees. Click **Issue Full Refund** or **Issue Partial Refund** and check the refund status.
3. For a full refund, open the WISECP invoice: `{admin}/invoices/detail?id={invoice}`. Select **Summary → Change Status → Refunded** and **Add as expense**.
4. Click **Update Status**. WISECP records the refund without requesting another transfer. Record partial refunds separately for their actual amount.

## Things to Watch

> **Authorization Is Not Capture**
> 
> The current module accepts a valid signed return without checking captured status. Authorize can close a WISECP invoice before funds are captured. Verify capture in Razorpay before supplying the service.

> **A Lost Return Needs Reconciliation**
> 
> No webhook updates this module after the browser return is lost. Compare the Razorpay payment with the invoice before collecting again. Successful saving alone does not prove that the selected capture action took effect.

## Required Privileges

WISECP settings require **Modules → Payment Gateways** (`MODULES_PAYMENT_SETTINGS`). Invoice changes require **Billing → Edit** (`INVOICES_OPERATION`). Razorpay API keys require its Owner or Admin role; refunds require access to the payment and refund controls.

## Related Articles

- [Payment Modules](https://docs.wisecp.com/en/payment-modules)
- [Invoice Detail Overview](https://docs.wisecp.com/en/invoice-detail-overview)
- [Razorpay API Keys](https://razorpay.com/docs/payments/dashboard/account-settings/api-keys/)
- [Razorpay Capture Settings](https://razorpay.com/docs/payments/payments/capture-settings/)
- [Razorpay Refunds](https://razorpay.com/docs/payments/refunds/issue/)
