Skip to content
Docs
Get RestroPress

RestroPress PayU Payment Gateway

Updated 2 min read
On this page

This plugin registers a gateway called PayU in RestroPress and sends the customer to PayU with a signed form. It is a small early-stage plugin (version 1.0.0, about 300 lines of code, placeholder author and website in the plugin header) and should be treated as a starting point, not a finished integration.

It is one of two near-identical plugins. The other one, restropress-payumoney-payment-gateway (PayUmoney), has the same code with a different name and option keys; the only functional difference is the address the form is posted to. This plugin posts to PayU's /_payment address.

Requirements#

  • RestroPress (the plugin only starts if the RestroPress class exists).
  • A PayU merchant account with a Merchant Key and Salt.

Installation#

Install the ZIP from Plugins › Add New › Upload Plugin and activate it. Then open RestroPress › Settings › Payment Gateways, tick PayU in the gateway list and save. The settings are in the PayU section of the same screen.

The plugin has no licence field, so there is no licence key to enter and no update checker in its code.

Settings#

PayU settings section
SettingWhat it doesDefault
Merchant KeyYour PayU Merchant Key.empty
SaltYour PayU Salt, used to sign the request and to check the response. It is a plain text field.empty
Test ModeUses the test address instead of the live one.Off

How it works#

  1. The customer chooses PayU at checkout. If the key or salt is empty, checkout shows "PayU configuration is incomplete."
  2. The plugin creates the order with status pending and builds a form with the key, transaction ID (the order ID), amount, product info "RestroPress Order", first name, email, phone, a success URL and a failure URL (both ?rpress-listener=payu on your site, with status=success or status=failure) and a SHA-512 hash of those values plus the salt.
  3. The browser auto-submits the form to https://secure.payu.in/_payment (or https://test.payu.in/_payment in Test Mode).
  4. When PayU posts back, the plugin recalculates the reverse hash from the salt and the posted values and compares it. If it matches and the posted status is success, the order is set to publish, the cart is emptied and the customer is redirected to the success page. Any other status marks the order failed and returns the customer to checkout with "Payment failed."

The plugin does not check the returned amount against the order, does not call PayU to confirm the transaction, does not check the store currency, does not schedule retries and does not support refunds. Errors are written to the PHP error log only when WP_DEBUG is on.

Troubleshooting#

  • "PayU configuration is incomplete." Merchant Key or Salt is empty.
  • "Hash verification failed." The hash PayU sent did not match the one the plugin calculated. Check that the salt matches the environment you are using.
  • "Payment not found" / "Invalid response from PayU". The return request had no usable transaction ID.
Was this page helpful?