Create Order
The "Create Order" API endpoint allows merchants to create an order for processing a payment. The API takes the necessary order information and customer details and returns a unique order ID and a pay
Create order Endpoint:
This endpoint is useful for initiating payments with a custom order ID and redirecting customers after they complete the payment.
POST /v1/payments/createOrderRequest
Code Example: Axios POST Request
Below is an example of how to use Axios to create a order request:
await axios.post(
"https://api.upitranzact.com/v1/payments/createOrderRequest",
{
mid: "Your Merchant ID", // Example: ABC
amount: "Numeric value between 1-100000", // Example: 200
order_id: "Unique order ID", // Example: bd79da4cc3ff1 (optional)
redirect_url: "https://example.com/success",
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)
redirect_url: Redirect to a custom web page after payment
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/createOrderRequest
<Description of the endpoint>
Headers
Content-Type
application/x-www-form-urlencoded
Authorization
Basic Auth
Body
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
redirect_url
string
URL to which the customer should be redirected after payment.
https://example.com/success
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": "Order request created successfully",
"data": {
"orderId": "utz_ccxxzsdf",
"payment_url": "https://upitz.com/checkout/payment/xxxxxxx..."
}
}
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