Alipay+ DocsAlipay+ Docs

decode

In entry code scenarios, Alipay+ stores the payment information as a code value. The Alipay+ client SDK calls the decode API to send the code value to the Mobile Payment Provider (MPP). The MPP can then call the server API userInitiatedPay to decode the code value and obtain the payment information.

Note: For entry codes to work, the MPP must implement the decode API.

Method signature

copy
public interface MPMService {
    
    void decode(DecodeServiceParams params, Callback<DecodeServiceResult> callback);
    
}

Request parameters

Item

Type

Description

Required

params

DecodeServiceParams

The parameters that are required to obtain the order information.

M

callback

Callback

The callback to be invoked after the decoding process ends. See Callback for details.

M

Callback

Item

Type

Description

Required

result

DecodeServiceResult

The result information that is required if the decoding is successful.

O

Response parameters

N/A

Sample

Definition of YOUR_MPM_SERVICE_CLASS:

copy
public class YOUR_MPM_SERVICE_CLASS implements MPMService {

    public void decode(DecodeServiceParams params, Callback<DecodeServiceResult> callback) {
    
        //Invoke the cashier after receiving the request from Alipay+
        //On success
        DecodeServiceResult result = new DecodeServiceResult();
        callback.onSuccess(result)
        //On failure
        callback.onFailure(errorCode, errorMessage);
        
    }


}

Instance of YOUR_MPM_SERVICE_CLASS:

copy
AlipayPlusClientMPM.getInstance().mpmService = new YOUR_MPM_SERVICE_CLASS();