Payments
Initialize Payment

Payment Handler

Payment handler to get snap url for payment

Endpoint

Base URL
http://localhost:8080
Method and Endpoint
POST /api/users/current/payment
Headers
Authorization: Bearer access_token

Query Param

order_id: string (required)

Responses

You will get example responses like this:

200 (success)

Response Body
{
  "message": "Initialize payment successfully",
  "result": {
    "snap_url": "midtrans-snap-url"
  }
}

401 (unauthorized)

Response Body
{
  "error": "Invalid authorization header"
}

401 (unauthorized - expire token)

Response Body
{
  "error": "token is expired: token is expired by 2m19s"
}

500 (server error)

Response Body
{
  "error": "Internal server error"
}

500 (server error - failed)

If something went wrong while create transaction on midtrans

Response Body
{
  "error": "failed create transaction"
}