Auto-debit process

Binding process

The binding process is used by merchants to obtain user authorization for subscribing AlipayHK auto-debit service. After users successfully signed the agreement to authorize for the AlipayHK auto-debit service, they can view the agreement again at anytime and be redirected back to merchant web if they want. The following graphic shows a whole binding process flow:

binding flow.png

  1. Users click the binding button to initiate the auto-debit signing process.

1.1 Merchant web view sends binding request to merchant backend.

1.1.1 Merchant backend calls the prepareForRedirect API to get authsite from the AlipayHK backend.

1.1.2 AlipayHK backend returns the authsite URL.

1.2 Merchant backend sends back authsite url to merchant web view.

1.3 Merchant web view redirects the AlipayHK Client to AlipayHK authsite URL.

1.3.1. AlipayHK client requests HTML signing info page from AlipayHK backend.

1.3.2 AlipayHK client renders returned signing info page.

  1. Users confirm the agreement and enter the payment password.

2.1 AlipayHK Client forwards the agreement confirmation to AlipayHK server.

2.2 AlipayHK server returns merchantRedirectURL with authcode to AlipayHK client.

2.3 AlipayHK Client redirects to merchantRedirectURL with authcode.

2.3.1 The Merchant Web View calls the backend with authcode.

2.3.1.1 Merchant Backend calls the applytoken to get accessToken.

2.3.1.2 AlipayHK Backend returns accessToken to the merchant backend.

2.3.1.3 Merchant webview renders the signing result page.

Unbinding process

Users can recall an approval process from an authorized merchant on the AlipayHK APP or merchant web view. The cancelByAuthInfo API can be called to unbind the AlipayHK auto-debit service from a merchant and update the subscription status.

systemflow2.png

Scenario 1: Users recall an approval process on the mechant app

  1. Users can check the binding status on Merchant Web View and initiate the unbinding request.

1.1 Merchant Web View forwards the unbind request to the Merchant Backend.

1.1.2 Merchant Backend calls the cancelByAuthInfo API to cancel the corresponding bind.

1.1.3 AlipayHK Backend returns the cancel result.

1.1.4 Mechant Web View renders the result.

  1. AlipayHK Backend sends the asynchronous response to Merchant Backend.

2.1 Merchant Backend updates the subscription status and the list of authorized merchants.

Scenario 2: Users recall an approval process on the AlipayHK app

  1. Users initiate the unbinding request in the AlipayHK app.

3.1 AlipayHK Backend receives and processes the unbinding request.

3.2 AlipayHK Client renders the unbinding result

3.3 An asynchronous notification of the cancel request is sent to Merchant Backend

3.3.1 Merchant Backend updates the subscription status and the list of authorized merchants.

Auto-debit transaction process

Merchants can initiate an auto-debit payment request by calling the agreement.pay API with accessToken. Users will receive the payment result via SMS and check bills in AlipayHK wallet in real time.

flow3.png

  1. The merchant generates a payment bill.
  2. Merchant Backend calls the agreement.pay API to initiate the payment request.

2.1 Alipay Backend returns payment result to Merchant Backend.

2.2 Alipay notifies the user with the payment result via SMS when payment is completed. 

2.3 Alipay Backend sends the asynchronous payment notification (notify_url) to Merchant Backend.

2.3.1 Merchant Backend checks and updates the transaction status based on the asynchronous   payment notification.

  1. Merchant Backend checks and updates the transaction status based synchronous payment response.