Razorpay

Setup

1

Get your Razorpay Credentials

To use Square, you need an API token. You can get them from the Razorpay Dashboard.

2

Configure the provider

To configure the provider

import { BetterPay } from "better-pay"

const provider = new BetterPay({
    provider: 'razorpay',
    keyId: 'YOUR_RAZORPAY_KEY_ID',
    keySecret: 'YOUR_RAZORPAY_KEY_SECRET'
})  

Usage

To implement the complete payment flow. Checkout this demo app.

Confirm Payment

To create payment link with razorpay, you can use the createPaymentLink function provided by the provider. It takes object with following properties:

Properties
  1. UPI Link

  2. Amount

  3. Currency

  4. Name (optional)

  5. Phone Number (optional)

  6. Email

  7. Is SMS (optional)

  8. Is Email (optional)

  9. Return Url

  10. Metadata (optional)

const response = await provider.createPaymentLink({
  upiLink: false, // UPI Link. By default false.
  amount: 1000,
  currency: 'INR',
  name: '', // optional
  phoneNumber:  , // optional
  email: 'test@gamil.com',
  isSMS: false // optional. By default false
  isEmail: false // optional. By default false
  returnUrl: 'YOUR_RETURN_URL_AFTER_SUCCESSFULL_PAYMENT',
  metadata: {} // optional
})
Response
  1. Reference Id

  2. Payment Link (use this link to make payment)

  3. Status

  4. Type

Last updated