Payment Gateway in Oracle APEX using Razorpay

   Razorpay Payment Gateway Integration in Oracle APEX (Step-by-Step Guide)

In this blog, I’ll show you how to integrate Razorpay and PayU payment gateways in your Oracle APEX application — similar to my Stripe payment gateway blog. You’ll get step-by-step instructions to implement both gateways, from obtaining API keys to processing payments inside Oracle APEX.

👉 I also have a YouTube video demonstrating the Razorpay integration you can check here:
https://youtu.be/T9OyXVbBlPQYouTube

Razorpay Payment Gateway Integration in Oracle APEX

Step 1: Create a Razorpay Account

  1. Go to https://razorpay.com and sign up for an account.

  2. Navigate to the Dashboard → API Keys.

  3. Generate your Test API Key ID and Secret Key (you will replace these with Live keys later).

Step 2: Create Required Database Objects

Before integration, set up tables and procedures to store order/payment data. Upload your SQL scripts via:

SQL Workshop → SQL Scripts → Upload & Run

Created page items for the payment to get its value and forwading that values to the payment website for the test mode to get performed.


Step 3: Create Order in Razorpay (PL/SQL Process)

Set up a Page Process (After Submit) that creates a Razorpay Order using REST API:

Sample code :

DECLARE

  l_response CLOB;

BEGIN

  l_response := apex_web_service.make_rest_request(

    p_url         => 'https://api.razorpay.com/v1/orders',

    p_http_method => 'POST',

    p_username    => '<<YOUR_RAZORPAY_KEY_ID>>',

    p_password    => '<<YOUR_RAZORPAY_SECRET>>',

    p_body        => 'amount=' || :PXX_AMOUNT*100 || '&currency=INR&receipt=receiptnumber'

  );

END;

Step 4: Add Razorpay Checkout Script

On your page’s HTML Header, add:

<script src="https://checkout.razorpay.com/v1/checkout.js"></script> ---Html

Then add a Dynamic Action on your button to trigger JavaScript:

var options = { "key": "<<YOUR_RAZORPAY_KEY_ID>>", "amount": parseInt($v("PXX_AMOUNT"))
* 100, "currency": "INR", "name": "APEX Payment", "order_id": "<<GENERATED_ORDER_ID>>" }; var rzp = new Razorpay(options); rzp.open();





Comments

Popular posts from this blog

Converting your Spreadsheet into a Cloud App using Oracle APEX

Building a Wizard-Based Application in Oracle APEX