E. Ticket

A. Create Ticket

image.png

User Authorizations

  1. User enter Merchant mini-app, view and browse mini-app's content.
    1. Merchant mini-app call my.getAuthCode() to request for user's authorization with a specific scope.
    2. User confirm to proceed.*
    3. Mini-app receive my.getAuthCode() callback with authcode.
    4. Mini-app backend call applyToken API to request for accessToken, userid will also be returned through applyToken API.
    5. Merchant backend must save userid and accessToken for further use.

*There will be no pop-up window for user to click if scope is only "auth_base".

Finish payment in Mini-app

  1. User place order from mini-app and proceed to pay.
    • Mini-app payment integration Guide.*

*Please confirm your payment integration solution with AlipayHK Integration Team.

  1. Mini-app backend call AlipayHK /createPass API with userid, merchantId, templateCode and other relate information.
    1. After successfully created the ticket, AlipayHK backend will return passId and handling result.
    2. Merchant backend should save passId for further use.

Meanwhile, the order detailed page should also be shown in mini-app for user checking.

Best Practice

In some scenarios merchant system may not be able to receive the accurate ticket status in time, AlipayHK suggest merchant to follow below rules to handle:

If merchant system has a default completion time for each order, set the endDate field in /createPass API to 1 hour later than this time, if not, set the endDate field 5 hours later than the journey's completion time, eg, the arrival time of a flight/train.


B. Update Ticket Details

image.png

  1. When user's journey is updated in merchant's system, eg. flight delay, passenger 's info changed, event schedule changed etc,
  2. Merchant backend trigger to update ticket content by calling AlipayHK /updatePass API in a real-time manner, set status field to UPDATE and updateDetailType field to the corresponding ticket type which was defined in /createPass API, pass the lasted ticket information through dataInfo field. endDate field should also be updated when journey's/event's time changed.
    1. Upon receiving update request, AlipayHK backend starts to proceed the request. Once successfully handled, user can check the latest ticket from AlipayHK card wallet.
    2. Meanwhile, AlipayHK backend will return the handling result through /updatePass API response.

C. Update Ticket after "USED"

image.png

  1. Merchant Backend has successfully handled the verification process of user's ticket.
  2. Merchant backend trigger to update ticket status by calling AlipayHK /updatePass API in a real-time manner, set status to USED with essential parameters including userid, merchantid, passId etc.
    1. Upon receiving update request, AlipayHK backend starts to proceed the request. Once successfully handled, the used ticket will be moved to used/expired tab in user's AlipayHK card wallet.
    2. Meanwhile, AlipayHK backend will return the handling result through /updatePass API response.

Best Practice

In some scenarios merchant system may not be able to receive the accurate ticket status in time, AlipayHK suggest merchant to call /updatePass and turn the status to USED right after the order completed in merchant system.

D. Delete Ticket

image.png

  1. When the journey/event is cancelled or refund, merchant backend should handle the removing process of user's ticket.
  2. Merchant backend trigger to update ticket status by calling AlipayHK /updatePass API, set status to CLOSED with essential parameters including userid, merchantid, passId etc.
    1. Upon receiving update request, AlipayHK backend starts to proceed the request. Once successfully handled, the used ticket will be moved to used/expired tab in user's AlipayHK card wallet.
    2. Meanwhile, AlipayHK backend will return the handling result through /updatePass API response. Once executed, this passid is no longer valid in AlipayHK system.

E. Reschedule Ticket

image.png

  1. When user require to change the reservation, merchant backend should handle the re-schedule process of user's ticket.
  2. Merchant backend trigger to update ticket status by calling AlipayHK /updatePass API, set the current ticket status to CLOSED with essential parameters including userid, merchantid, passId etc.
    1. Upon receiving update request, AlipayHK backend starts to proceed the request. Once successfully handled, the used ticket will be disappeared in user's AlipayHK card wallet.
    2. Meanwhile, AlipayHK backend will return the handling result through /updatePass API response. Once executed, this passid is no longer valid in AlipayHK system.
    3. After receiving handling result from AlipayHK, merchant backend should call AlipayHK /createPass API with userid,merchantId,templateCode and other related information.
    4. - 2.5 After successfully created the ticket, AlipayHK backend will return passId and handling result. User can check the lastest ticket from AlipayHK card wallet.

Merchant backend should save passId and replace the invalid old passid.