Alipay+ DocsAlipay+ Docs

generateTransitCode

The generateTransitCode API enables the Alipay+ Cross-border Transport mini program to request the Alipay+ OfflinePay SDK to generate the Transport Code, which is a QR code.

Note:

  • The mini program calls this API using the my.call method.
  • You need to add an allowlist to the mini program metadata.

Method signature

copy
my.call(
  'generateTransitCode',
  {
    cardType: card.cardType,
    cardNo: card.cardNo,
    source: systemInfo.appShortName,
    qrCodeWidth: '1000',
    qrCodeHeight: '1000',
    isManual: JSON.stringify(isManual),
  }
);

Parameters

Parameter

Data type

Description

cardType

String

The Transport Code service card type.

cardNo

String

The Transport Code service card number.

qrCodeWidth

String

The width of the QR code.

qrCodeHeight

String

The height of the QR code.

qrCodeLevel

String

The level of the QR code size.

source

String

The source that invokes the API call.

isManual

String

Whether the code is refreshed manually or automatically.

Valid values are:

  • true: indicates that the code is refreshed manually.
  • false: indicates that the code is refreshed automatically.

Return values

Parameter

Data type

Description

isSuccess

Boolean

Whether the request is successful.

Valid values are:

  • true: indicates that the request is successful.
  • false: indicates that the request failed.

result

String

The Base64-encoded Transport Code image.

status

Integer

The user entry and exit station status.

Valid values are:

  • 0: indicates in station.
  • 1: indicates out of station.

errorIndicator

String

The description of an error.

autoRefreshMiliSec

Integer

The refresh interval (milliseconds).

Error codes

Error code

Error message

Description

10001

Permission denied.

Permission verification failed.

10002

Card No. or Card Type is empty.

Parameter validation failed.

10003

Code Generation Failed.

Base64 pattern code generation exception

10004

Network error. Please check your connection or click Retry.

Network exception

10006

Failed to obtain the QR code.

Failed to obtain the QR code.

10007

Code Protocol Not supported. Please update your app.

Unsupported code protocol

10008

The system is busy. Please try again later.

The system is busy.

10009

Failed to generate the code.

Authentication is required.

10010

QR code generation failed.

QR code generation failed.