Payin Page
Api Endpoint:
This API for Payin Page will be a POST request.
{BaseUrl}/user/sendPayinPageRequest
Description
The Payin Page API allows a user to generate a payment page URL. This is typically used in scenarios where a customer is asked to pay a specified amount using their UPI ID through a web interface. Upon successful initiation, a URL is generated for the customer to complete the payment.
Request
Request Header
The request must include the following headers for authentication:
{
"apiKey": "your api key",
"token": "your token",
"content-type": "application/json"
}
- apiKey: Your unique API key provided by PayHub.
- token: A token that validates your session or request.
- content-type: Specifies that the request body is in JSON format.
Request Body
The body of the request should include the following parameters:
{
"amount": "100",
"username": "customer name",
"phone": "customer phone number",
"customer_email": "customer email",
"orderId":"Merchant's order id"(Optional),
"label":"ACME CORP",(optional)
}
- upiId: The UPI ID of the customer to whom the payment request is being sent.
- 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.
- label: The business name on payment page that merchant wants to show.
Body schema
{
"amount": {
"type": "number",
"format": "float(10,2)", // up to 2 decimals
"min": 1,
"max": 10000
},
"username": {
"type": "string",
"maxLength": 100
},
"phone": {
"type": "string",
"maxLength": 13,
"pattern": "^(\\+91)?[6-9]\\d{9}$" // Indian mobile: 10 digits, optional +91
},
"customer_email": {
"type": "string",
"maxLength": 254
},
"label": {
"type": "string",
"maxLength": 50 // sensible limit for tags/labels
},
"orderId": {
"type": "string",
"maxLength": 25, // recommended
"optional": true, // not always required
"note": "special characters allowed"
}
};
Possible Responses:
Success Response
A successful response indicates that the payin page URL has been generated and includes the transaction details.
{
"responseCode": 200,
"responseMessage": "Success",
"responseData": {
"url": "https://payments.PayHub.link/?txid=54661&token=eyJhbGciOiJIUsInR5cCI6IkpXVCJ9.eyJlbWFpbElkIjoidGVzdEBwYXlodWIiLCJhcGlLZXkiOiJVMkZzZEdWa1gxOGg1RVBkZVRiNUFzbmloL2Ruby9Kakl3djJBVGQ5S21RPSIsImlhdCI6MTczMzcyMTM5NSwiZXhwIjoxNzMzNzIyMjk1fQ.XIMFL_7eSIKn70zUJTG97xCPBdgnB",
"transaction_id": "o_DPjeq6yX1hadsahgfhtkjklZ04cWs"
}
}
- responseCode: 200 - Indicates a successful request.
- responseMessage: Success - A message indicating the request was successful.
- responseData: Contains the payment page URL and transaction details.
- url: https://payments.PayHub.link/?txid=54661&token=eyJhbGciOiJIUsInR5cCI6IkpXVCJ9.eyJlbWFpbElkIjoidGVzdEBwYXlodWIiLCJhcGlLZXkiOiJVMkZzZEdWa1gxOGg1RVBkZVRiNUFzbmloL2Ruby9Kakl3djJBVGQ5S21RPSIsImlhdCI6MTczMzcyMTM5NSwiZXhwIjoxNzMzNzIyMjk1fQ.XIMFL_7eSIKn70zUJTG97xCPBdgnB - A URL that redirects the customer to the payment page to complete the payment.
- transaction_id: o_DPjeq6yX1hadsahgfhtkjklZ04cWs - A unique identifier for the transaction.
Error Responses
If there is an issue with the request, one of the following error responses will be returned:
Invalid API Key
{
"responseCode": 401,
"responseMessage": "Invalid apiKey"
}
- responseCode: 401 - Indicates forbidden access due to an invalid API key.
- responseMessage: Invalid apiKey - A message indicating the provided API key is invalid.
Invalid User
{
"responseCode": 400,
"responseMessage": "User does not exist"
}
- responseCode: 400 - Indicates a bad request due to a non-existent user.
- responseMessage: User does not exist - A message indicating the user specified in the request does not exist.
{
"responseCode": 400,
"responseMessage": "Invalid details"
}
- responseCode: 400 - Indicates a bad request due to invalid details.
- responseMessage: Invalid details - A message indicating that some of the details provided in the request are invalid.
Notes
- Ensure that all required parameters are provided and valid.
- Check the response codes to handle different outcomes appropriately in your application.
- For security, keep your API key and token confidential.
By following this documentation, you can integrate and use the Payin Page API effectively in your payment gateway system.