Skip to content

Sell tickets online

Use this guide to sell tickets from your own storefront: the buyer picks tickets, pays with a payment method the ticket group offers, and gets the tickets by email. For every field and error, see the Commerce API.

Before you begin

  • You know the ID of the ticket group to sell and the IDs of its ticket variants. Get them from the Catalogue API.
  • Your storefront has a /paymentRedirect page, and its address is set for your deployment. The buyer comes back to this page after paying.
  • No token is needed for a guest buyer. For a signed-in customer, you have the customer token from the customer sign-in in the Identity API.

Steps

  1. List the payment methods the ticket group offers.

    curl "https://<API_HOST>/payment/methods?ticketGroupId=<TICKET_GROUP_ID>"
    

    Replace <TICKET_GROUP_ID> with the ticket group ID. You get the methods to show the buyer:

    {
      "success": true,
      "data": [
        { "id": "7c1f3b0e-2a44-4d3c-9a51-3f0b8f2d6e10", "name": "Online banking", "provider": "johorpay", "bankSelection": true }
      ]
    }
    
  2. If the chosen method has "bankSelection": true, list its banks and let the buyer pick one.

    curl -X POST "https://<API_HOST>/payment/bankList" \
      -H "Content-Type: application/json" \
      -d '{ "ticketGroupId": <TICKET_GROUP_ID>, "paymentProfileId": "<PAYMENT_METHOD_ID>", "mode": "individual" }'
    

    <PAYMENT_METHOD_ID> is the id from step 1. You get the banks; show those with "enabled": 1:

    { "success": true, "banks": [ { "value": "MBB0228", "name": "Maybank2U", "enabled": 1 } ] }
    
  3. Create the order.

    curl -X POST "https://<API_HOST>/api/orderTicketGroup" \
      -H "Content-Type: application/json" \
      -d '{
        "ticketGroupId": <TICKET_GROUP_ID>,
        "date": "2026-07-20",
        "langChosen": "en",
        "tickets": [ { "ticketId": "<TICKET_VARIANT_ID>", "qty": 2 } ],
        "paymentType": "fpx",
        "mode": "individual",
        "bankCode": "<BANK_CODE>",
        "paymentProfileId": "<PAYMENT_METHOD_ID>",
        "fullName": "Aisyah Rahman",
        "email": "aisyah@example.com",
        "contactNo": "+60123456789",
        "identificationNo": "900101-01-1234"
      }'
    

    <BANK_CODE> is the value from step 2. For a card method, send "paymentType": "credit/debit" and leave out mode and bankCode. For a signed-in customer, add -H "Authorization: Bearer <CUSTOMER_TOKEN>" and leave out the four buyer fields. You get 201 Created with the order ID:

    { "respCode": 2000, "respDesc": "Success", "result": { "orderID": 18342, "redirectURL": "/checkout.html?orderID=18342&paymentType=fpx" } }
    
  4. Read the order to get its order number.

    curl "https://<API_HOST>/api/orderTicketGroup?orderTicketGroupId=18342"
    

    The order is in result.orderProfile, with "transactionStatus": "initiate" and its orderNo, for example 20260715TB004821937.

  5. Start the payment.

    curl -X POST "https://<API_HOST>/payment/start" \
      -H "Content-Type: application/json" \
      -d '{ "orderNo": "20260715TB004821937" }'
    

    You get the payment step:

    { "success": true, "data": { "kind": "form_post", "url": "https://pay.example.com/payment", "fields": { "jp_order_no": "20260715TB004821937" } } }
    
  6. Send the buyer's browser on. For "kind": "form_post", build an HTML form with method="post", action set to url and one hidden input per entry in fields, unchanged, and submit it. For "kind": "redirect", open url.

    The buyer pays on the provider's page. Afterwards the browser lands on your /paymentRedirect page, for example /paymentRedirect?orderTicketGroupId=18342&transactionStatus=success&orderNo=20260715TB004821937.

Verify

On your /paymentRedirect page, read the order again (step 4) and check transactionStatus:

  • success: the tickets are issued and emailed to the buyer; orderTicketInfo lists them.
  • pending: the bank hasn't confirmed yet. Show "payment in progress" and read the order again later.
  • failed: offer to pay again (step 5) or to start over.

A guest can find the order later with GET https://<API_HOST>/api/orderNonMemberInquiry?orderNo=<ORDER_NO>&email=<EMAIL>.

Troubleshooting

Symptom Cause Fix
400 "paymentProfileId is required" The ticket group offers more than one payment method. Send the id from step 1 as paymentProfileId.
400 "All customer information … must be provided" A guest order without all four buyer fields. Send fullName, email, contactNo and identificationNo, or a customer token.
403 "Tickets quantity have exceeded the total limit" More tickets than the ticket group allows in one order. Lower the quantities.
409 "order has already been paid" The order is success. Don't pay again; show the order.
409 "a payment for this order is still being processed" The order is pending. Wait for the final result.
502 from Start a payment The payment provider couldn't be reached. Retry step 5.

Next steps