Alipay+ DocsAlipay+ Docs

Alipay+ ACQP Web/WAP SDK interfaces

The following sections introduce the interfaces that are provided by the Alipay+ ACQP Web/WAP SDK.

1. Overview

This section describes the interfaces that are used in the interaction between the SDK and your project.

1.1 API

Interface name

Description

AlipayPlus.create()

Create an instance of the Alipay+ Web/WAP SDK object.

loadAlipayPlus()

Load the Alipay+ Web/WAP SDK object.

inquirePaymentOption()

Inquire about the availability of and how to render the Alipay+ payment method on the payment method page.

Note: Used only in the Cashier Payment scenario.

inquireAuthorizationOption()

Inquire about the availability of and how to render the Alipay+ payment method on the payment method page or add payment method page.

Note: Used only in the Auto Debit scenario.

2. APIs

AlipayPlus.create()

Use this API to create an instance of the Alipay+ Web/WAP SDK object.

Syntax

copy
AlipayPlus.create(config);

Arguments

Name

Type

Description

Required

config

IConfig

An object that includes the parameters for setting up the SDK.

M

Returns

Type

Description

AlipayPlus

An instance of the Alipay+ Web/WAP SDK object.

Examples

copy
const alipayPlus = AlipayPlus.create({
  acquirerId: 'acquirerId',
  merchantId: 'merchantId',
  language: 'en_US',
  envType: 'SANDBOX',
});

loadAlipayPlus()

Use this API to load the Alipay+ Web/WAP SDK object.

Note: This API exists only in the alipayplus-sdk-acqp-web package.

Syntax

copy
loadAlipayPlus();

Arguments

N/A

Returns

Type

Description

AlipayPlus

The Alipay+ Web/WAP SDK object.

Examples

copy
import { loadAlipayPlus } from 'alipayplus-sdk-acqp-web';

loadAlipayPlus().then((AlipayPlus) => {
  const config = {
    acquirerId: 'acquirerId', // acquirer ID
    merchantId: 'merchantId', // merchant ID
    envType: 'SANDBOX', // Change to 'PROD' for the online.
    language: 'en_US',
  };
  const alipayPlus = AlipayPlus.create(config);
}, (error) => {
  // handle error
});

inquirePaymentOption()

Use this API to inquire whether the Alipay+ payment method is available and if so, related data about the Alipay+ payment method, such as the Alipay+ logo information and promotion information.

Note: This API is used only in the Cashier Payment scenario.

Syntax

copy
alipayPlus.inquirePaymentOption(params);

Arguments

Name

Type

Description

Required

params

IInquirePaymentOptionParams

An object that contains the parameters for querying the data about the Alipay+ payment method.

M

Returns

Type

Description

Promise<IPaymentOption>

The data about the Alipay+ payment method.

This parameter is returned if the inquiry is successful.

Errors

Type

Description

IErrorCode

The error code about the inquiry.

Examples

copy
alipayPlus.inquirePaymentOption({
  paymentCurrency: 'PHP',
}).then((paymentOption) => {
  console.log(paymentOption);
}, (error) => {
  // handle error
});

inquireAuthorizationOption()

Use this API to inquire whether the Alipay+ payment method is available and if so, related data about the Alipay+ payment method, such as the Alipay+ logo information and promotion information.

Note: This API is used only in the Auto Debit scenario.

Syntax

copy
alipayPlus.inquireAuthorizationOption(params);

Arguments

Name

Type

Description

Required

params

IInquireAuthorizationOptionParams

An object that contains the parameters for querying the data about the Alipay+ payment method.

M

Returns

Type

Description

Promise<IAuthorizationOption>

The data about the Alipay+ payment method.

This parameter is returned if the inquiry is successful.

Errors

Type

Description

IErrorCode

The error code about the inquiry.

Examples

copy
alipayPlus.inquireAuthorizationOption({
  paymentCurrency: 'PHP',
}).then((authorizationOption) => {
  console.log(authorizationOption);
}, (error) => {
  // handle error
});

3. Appendices

IConfig

Name

Type

Description

Required

merchantId

String

The unique ID that is assigned by the ACQP to identify a merchant.

Note: The value of this parameter must be the same as the one that is specified when calling the pay API.

M

acquirerId

String

The unique ID that is assigned by Alipay+ to identify an ACQP.

M

language

String

The language that is preferred by the user. The value of the parameter consists of a language code following the ISO-639 standard and a country code following the ISO-3166 standard. The codes are connected by an underscore. For example, en_US.

Valid values are:

  • zh_CN: Simplified Chinese
  • zh_HK: Traditional Chinese
  • en_US: English
  • ko_KR: Korean
  • fil_PH: Filipino
  • ms_MY: Malay
  • id_ID: Indonesian
  • th_TH: Thai

Note:

  1. If a valid value is specified for the language parameter, the specified language is used.
  2. If no valid value is specified for the language parameter and the language set on the mobile or PC device is one of the 8 languages listed above, the language set on the mobile or PC device is used.
  3. If no valid value is specified for the language parameter and the language set on the mobile or PC device is not one of the 8 languages listed above, the English language is used.

O

envType

String

The type of environment where the SDK is installed. The value of this parameter affects the gateway address of the requests that are initiated from the SDK.

Valid values:

  • PROD: indicates the production environment.
  • SANDBOX: indicates the sandbox environment.

Default value: RPOD

O

IInquirePaymentOptionParams

Name

Type

Description

Required

paymentCurrency

String

The payment currency that is supported by the merchant.

The value of this parameter must be an alphabetic code that follows the ISO 4217 standard, for example, "EUR" for Euros.

M

logoPattern

String

The pattern of the logo, such as P1-WEB-01. The value consists of the following three parts:

  • The layout of the logo. Valid values are:
  • P1: indicates that the Alipay+ logo is located on the left of wallet logos.
  • P2: indicates that the Alipay+ logo is above wallet logos.
  • The terminal type that the logo is applied to. Valid values are WEB and APP.
  • Custom field with a maximum length of 10 characters. The default values are sequential numbers starting from01.

O

IPaymentOption

Name

Type

Description

Required

enabled

Boolean

Indicates whether the Alipay+ payment method is available.

M

paymentMethodType

String

The payment method that is provided by Alipay+.

Valid values are:

CONNECT_WALLET: indicates the Alipay+ payment method.

M

logos

Array<ILogo>

The logo information of the Alipay+ payment method.

Note: Nullable if the value of the enabled parameter is false.

O

brandName

String

The brand name of the Alipay+ payment method.

Note: Nullable if the value of the enabled parameter is false.

O

disableReason

String

The reason why the Alipay+ payment method is unavailable.

Note: The value of this parameter is null if the value of the enabled parameter is true.

O

promoNames

Array<String>

The list of promotion campaigns in the language that is preferred by the user.

Each element in the array is a string that indicates the promotion name, such as RM1 Voucher.

Currently, the array contains only one element indicating one specific promotion campaign, which is the best offer that Alipay+ recommends to be displayed alongside the logo, rather than multiple different promotion campaigns.

O

IAuthorizationOptionParams

Name

Type

Description

Required

paymentCurrency

String

The payment currency that is supported by the merchant.

The value of this parameter must be an alphabetic code that follows the ISO 4217 standard, for example, "EUR" for Euros.

M

logoPattern

String

The pattern of the logo, such as P1-WEB-01. The value consists of the following three parts:

  • The layout of the logo. Valid values are:
  • P1: indicates that the Alipay+ logo is located on the left of wallet logos.
  • P2: indicates that the Alipay+ logo is above wallet logos.
  • The terminal type that the logo is applied to. Valid values are WEB and APP.
  • Custom field with a maximum length of 10 characters. The default values are sequential numbers starting from01.

O

IAuthorizationOption

Name

Type

Description

Required

enabled

Boolean

Indicates whether the Alipay+ payment method is available.

M

paymentMethodType

String

The payment method that is provided by Alipay+.

Valid values are:

CONNECT_WALLET: indicates the Alipay+ payment method.

M

logos

Array<ILogo>

The logo information of the Alipay+ payment method.

Note: Nullable if the value of the enabled parameter is false.

O

brandName

String

The brand name of the Alipay+ payment method.

Note: Nullable if the value of the enabled parameter is false.

O

disableReason

String

The reason why the Alipay+ payment method is unavailable.

Note: The value of this parameter is null if the value of the enabled parameter is true.

O

promoNames

Array<String>

The list of promotion campaigns in the language that is preferred by the user.

Each element in the array is a string that indicates the promotion name, such as RM1 Voucher.

Currently, the array contains only one element indicating one specific promotion campaign, which is the best offer that Alipay+ recommends to be displayed alongside the logo, rather than multiple different promotion campaigns.

O

ILogo

Name

Type

Description

Required

logoName

String

The name of the logo.

O

logoUrl

String

The URL of the logo.

O

logoPattern

String

The pattern of the logo, such as P1-WEB-01. The value consists of the following three parts:

  • The layout of the logo. Valid values are:
  • P1: indicates that the Alipay+ logo is located on the left of wallet logos.
  • P2: indicates that the Alipay+ logo is above wallet logos.
  • The terminal type that the logo is applied to. Valid values are WEB and APP.
  • Custom field with a maximum length of 10 characters. The default values are sequential numbers starting from01.

O

logoWidth

String

The width of the logo.

O

logoHeight

String

The height of the logo.

O

IErrorCode

Name

Type

Description

Required

errorCode

number

The error code.

O

errorMessage

String

The error message.

O

Samples

errorCode

errorMessage

Description

1001

PARAM_ILLEGAL

Illegal parameters exist.

1002

INVALID_NETWORK

A network error occurs.

1003

SYSTEM_ERROR

A system error occurs.