Skip to main content

Payin(QR Based)

API Endpoint:

This API for Payin QR will be a POST request.

{BaseUrl}/user/sendPayinRequestQR

Description

The Payin QR API enables a merchant to initiate a UPI-based payment request where the customer scans a QR code to complete the transaction. This is commonly used in UPI-compatible applications where scanning a QR is more convenient than entering a UPI ID.

Request:

Request Header

The request must include the following headers for authentication:

Request Header
{
"apiKey": "your api key",
"token": "your token"
}
  • apiKey: Your unique API key provided by PayHub.
  • token: A token that validates your session or request.

Request Body

The body of the request should include the following parameters:

Request Body
{
"amount": "100",
"username": "customer name",
"phone": "customer phone number",
"customer_email": "customer email",
"orderId": "Merchant's order id"
}
  • upiId: The UPI ID of the customer to whom the payment request is being sent.(optional)
  • amount: The amount to be paid by the customer.
  • username: The name of the customer.
  • phone: The phone number of the customer.
  • customer_email: The email address of the customer.
  • orderId: Your internal transaction or order identifier.

Possible Responses:

Success Response

A successful response returns a QR code image in base64 format for scanning and a unique transaction ID.

Success Response
{
"responseCode": 200,
"responseMessage": "Success",
"responseData": {
"url": "https://payments-sandbox.payhub.link/?txid=657e3&token=eyJIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE3NDU4MjY3OTEsImV4cCI6MTc0NTgyNzY5MX0.OtAFMB17C06rY8SJ6iX9g&url=https://xyxyxyxyxyx.com/?tx",
"transaction_id": "7065962"
}
}
  • url: A URL that redirects the customer to the payment page to complete the payment.
  • transaction_id: A unique identifier for this payment transaction.

Error Responses

If there is an issue with the request, one of the following error responses will be returned:

Invalid API Key
Invalid API Key
{
"responseCode": 403,
"responseMessage": "Invalid apiKey"
}
Invalid Details
Invalid Details
{
"responseCode": 400,
"responseMessage": "Invalid details"
}

Notes

  • Ensure all required parameters are correctly provided.
  • Validate your API key and token before making requests.
  • Handle error codes and messages in your application flow to improve user experience.
  • The QR code returned can be displayed to the customer for scanning via any UPI-compatible app.

By integrating this Payin Intent (QR) API, merchants can offer a seamless UPI payment experience using QR code scanning.