Payments
Request Order Token
Initiates a payment transaction and returns a payment token from Midtrans
POST
Overview
This endpoint creates a new order and requests a payment token from Midtrans payment gateway. The token is used to redirect customers to the Midtrans payment page where they can complete their transaction.Authentication
This endpoint requires authentication via cookie-based access token.The ID of the product to purchase
Request Body
The request must include transaction details and customer information.Details about the transaction
Customer information for the order
Response
Response status, always “success” for successful requests
Payment token data from Midtrans
Notes
- The endpoint generates a unique
order_id(UUID) for each request - The order is created in the database before requesting the Midtrans token
- The
gross_amountshould match the calculation: product price ×product_count_total - The returned token is used with Midtrans Snap to display the payment page
- The
redirect_urlcan be used to redirect customers directly to the payment page - After payment, Midtrans will send a webhook notification to update the order status