Alipay, China's leading third-party online payment solutionAlipay, China's leading third-party online payment solution

CreateTemplate

Create Voucher Template

API:xxx/createTemplate

Request Method: POST

Alipay+ Rewards will call this interface to create a voucher template in Wallet side.

Direction: Alipay+ Rewards ---> Wallet

Request

(M=Madantory, C=Conditional, O=Optional)

header

Field

Type

Length

Mandatory

Detail

Sample

clientId

String

8

M

Client ID

2110200000000044

signature

String

1024

M

Signature

algorithm=sha256withrsa,keyVersion=2,signature=xxxxxxxxxxxyyyyyyyyyyyyyyzzzzzzzzz==

encrypt

String

32

O

encrypt method

algorithm=rsa, keyVersion=2

Content-type

String

/

M

Http content type

application/json; charset=UTF-8

body

Field

Type

Length

Madantory

Description

Sample

requestId

String

32

M

Requestid, used for identify a unique request.
should be idempotent

62021122800135202000000000263818

startTime

String

32

M

Voucher Template validity from

follows the ISO-8601 standard

2022-03-17T12:08:56+05:30

endTime

String

32

M

Voucher Template validity to

follows the ISO-8601 standard

2022-04-17T12:08:56+05:30

voucherType

String

32

M

Voucher type

  • PAYMENTVOUCHER(Alipay+ payment voucher)
  • MERCHANTVOUCHER(Voucher redeemed in merchant side)

PAYMENTVOUCHER

title

String

256

M

Template title

{

"en_US":"Up to $50 available",

"bahasa_MY":"bahasa_MY"

}

brandName

String

4096

M

Brand name

{

"en_US":"Up to $50 available",

"bahasa_MY":"bahasa_MY"

}

logo

String

1024

M

Brand logo URL

picture

String

1024

M

Voucher main picture URL

scenario

String

1024

M

  • ONLINE
  • OFFLINE

discountInfo

DiscountInfo

1024

M

Discount info

codeType

String

32

M

  • NONE
  • TEXT
  • BARCODE
  • QRCODE
  • BARCODE_QRCODE

codeStandard

String

32

C

  • CODE128
  • EAN-13
  • QRCODE

button

Button

1024

O

description

String

4096

M

Description

{

"en_US":"Up to $50 available",

"bahasa_MY":"bahasa_MY"

}

termsAndConditions

String

4096

M

T&C

{

"en_US":"Up to $50 available",

"bahasa_MY":"bahasa_MY"

}

howToUse

Map<String,List<String>>

4096

M

How to use

{

"en_US":

[{step1:xxx},{step2:xxx}]

}

discountInfo

Field

Type

Mandatory

Length

Detail

Sample

discountType

String

M

  • FIXEDAMOUNT
  • DISCOUNT
  • EXCHANGE

EXCHANGE

discountRate

String

C

  • discountType=DISCOUNT
  • 1 - 99

90%

capAmount

Amount

C

  • discountType=DISCOUNT

amount

Amount

C

discountType=FIXEDAMOUNT

valueText

String

C

discountType=EXCHANGE

  • ReloadPIN RM 2.00
  • iQiyi 1 month Premuim

Amount

Field

Type

Mandatory

Length

Detail

Sample

value

String

C

Cent

10000 (100.00 MYR)

currency

String

C

MYR

MYR

Button

Field

Type

Mandatory

Length

Detail

buttonType

String

M

  • NONE
  • SCAN
  • QR_PAY
  • WEB_PAGE

usage

buttonLabel

String

O

Button text

Use It

buttonUrl

String

C

URL

buttonType=WEB_PAGE

https://www.xxxxxx.com

Response

body

Field

Type

Length

Madantory

Description

Sample

templateId

String

32

M

TemplateId created in wallet side

T00000000000001

resultInfo

ResultInfo

/

M

Result Info

ResultInfo

Field

Type

Length

Madantory

Description

Sample

resultStatus

String

32

M

S - Successful

F - Failed

U - Unknown

S

resultCode

String

32

M

Error Code

SYSTEM_BUSY

resultMessage

String

256

M

Error Message

system busy,retry again.

Error Code

ResultCode

ResultStatus

ResultMessage

SUCCESS

S

Success

PARAM_ILLEGAL

F

Illegal parameters exist. For example, a non-numeric input, or an invalid date.

REQUEST_TRAFFIC_EXCEED_LIMIT

U

The request traffic exceeds the limit.

SYSTEM_ERROR

U

System process occour error

Sample

request

copy
{
    "requestId":"121212812811211jhkjhkj9878jkjkj",
    "startTime":"2022-03-17T12:08:56+05:30",
    "endTime":"2022-12-17T12:08:56+05:30",
    "voucherType":"MERCHANTVOUCHER",
    "title":{
        "en_US":"Up to $50 available",
        "bahasa_MY":"bahasa_MY"
    },
    "brandName":{
        "en_US":"foodpada",
        "bahasa_MY":"foodpada"
    },
    "logo":"http://img/logo.img",
    "picture":"http://img/8772.png",
    "scenario":"ONLINE",
    "discountInfo":{
        "discountType":"FIXEDAMOUNT",
        "amount":{
            "value":"100",
            "currency":"MYR"
        }
    },
    "codeType":"BARCODE",
    "codeStandard":"CODE128",
    "button":{
        "buttonType":"WEB_PAGE",
        "buttonLabel":"Use Now",
        "buttonUrl":"http://foodpada.com"
    },
    "description":{
        "en_US":"Rp1RB off for MobaPay Store",
        "bahasa_MY":"Rp1RB off for MobaPay Store"
    },
    "termsAndConditions":{
        "en_US":"Voucher can be used for single transaction minimum of Rp1.300",
        "bahasa_MY":"Voucher can be used for single transaction minimum of Rp1.300"
    },
    "howToUse":{
        "en_US":[
            "step1:go to merchant web site",
            "step2:copy the code",
            "step3:use the code"
        ]
    }
}

response

copy
{
    "templateId":"2022101919050111540210000000000108100021",
    "resultInfo":{
        "resultStatus":"S",
        "resultCode":"SUCCESS",
        "resultMessage":"Success."
    }
}