Payment Request

Payment Request Endpoint:

This endpoint is useful for initiating payments with a custom payment request and customers will pay via UPI App.

POST /v1/payments/createPaymentRequest

Code Example: Axios POST Request

Below is an example of how to use Axios to create a payment request:

await axios.post(
  "https://api.upitranzact.com/v1/payments/createPaymentRequest",
  {
    mid: "Your Merchant ID", // Example: ABC
    amount: "Numeric value between 1-100000", // Example: 200
    order_id: "Unique order ID", // Example: bd79da4cc3ff1 (optional)
    vpa: "Customer UPI Id", // Example: upiId@oksbi
    note: "Add money", // Payment remark
    customer_name: "John",
    customer_email: "john@example.com",
    customer_mobile: "Your Customer Mobile", // Correct value needed
  },
  {
    headers: {
      Authorization: "Basic base64(public_key:secret_key)"
    }
  }
);

Key Points

  • mid: Your merchant identifier.

  • amount: Must be a numeric value between 1 and 100000.

  • order_id: A unique string for transaction tracking. (optional)

  • vpa: Customer UPI Id

  • customer_name: Ensure this contains a name.

  • customer_email: Ensure this contains a valid email address.

  • customer_mobile: Ensure this contains a valid phone number instead of a name.

  • Authorization: Basic base64(public_key:secret_key).

Ensure all placeholders (e.g., "Your Merchant ID") are replaced with actual values before executing

Request Body Parameters:

POST /v1/payments/createPaymentRequest

<Description of the endpoint>

Headers

Name
Value

Content-Type

application/x-www-form-urlencoded

Authorization

Basic Auth

Body

Name
Type
Description
Example Value
Required

mid

string

Merchant ID assigned to you by UPITranzact.

ABC

Yes

amount

integer

The total amount.

200

Yes

order_id

string

A unique identifier for the order.

bd79da4cccff1

No

vpa

string

Customer UPI Id

upiId@oksbi

Yes

note

string

A remark for the payment.

Add Money

Yes

customer_name

string

The name of the customer making for the payment.

John

Yes

customer_email

string

The email address of the payment.

john@example.com

Yes

customer_mobile

string

The mobile number of the customer.

0123456789

Yes

Authorization:

The request must include an Authorization header with a Base64 encoded string containing your public_key and secret_key in the format public_key:secret_key. Here's an example of how to generate the Authorization header:

Example:

Authorization: "Basic base64(public_key:secret_key)"

For example, if your public_key is your_public_key and your secret_key is your_secret_key, you would encode this into Base64 and use it as the Authorization header.

Example Authorization Header (Base64 encoded):

Authorization: "Basic eW91cl9wdWJsaWNfa2V5OnlvdXJfc2VjcmV0X2tleQ=="

Response

{
    "status": true,
    "statusCode": 200,
    "msg": "Collect request created successfully",
    "data": {
        "expiry": "2025-01-20T13:30:16+05:30",
        "amount": "1",
        "order_id": "utz_xxxxxx"
    }
}

Error Codes:

  • 400: Bad Request - Missing required parameters or invalid data.

  • 401: Unauthorized - Invalid or missing Authorization Basic Auth.

  • 404: Not Found - An issue occurred on the server side.

  • 409: Conflict - The request could not be processed due to a conflict with the current state of the resource.

  • 500: Internal Server Error - An issue occurred on the server side.

Last updated