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

CreateVoucherInstance

Create Voucher Instance

Interface:XXX/createInstance

When user claims the voucher in Alipay+ Rewards, Alipay+ Rewards will call this interface to assign a same voucher into wallet pocket.

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

64

M

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

userId

String

32

M

Wallet userid

templateId

String

32

M

Wallet template Id

validFrom

Date

/

M

Voucher start time

follows the ISO-8601 standard

validTo

Date

/

M

Voucher expired time

follows the ISO-8601 standard

bizCreate

Date

/

M

Assignment time

codeInfo

String

128

O

Voucher information

{
"codeNo": "9123912839123712893",
"codePin": "9123912839123712893"
}

redirectUrl

String

1024

M

miniprogram URL of voucher detail

codeInfo

Field

Type

Length

Madantory

Description

Sample

codeNo

String

256

M

Code Number

CODE12345678

codePin

String

256

M

Code Pin

PIN12345678

Response

Field

Type

Length

Madantory

Description

Sample

resultInfo

ResultInfo

/

M

Result Info

voucherId

String

32

M

VoucherId of each voucher assigned by wallet.

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

TEMPLATE_NOT_FOND

F

Template not found

Sample

request

copy
{
    "requestId":"202210123467334400000000156",
    "userId":"210672124",
    "templateId":"2022101919050111540210000000000108100021",
    "validFrom":"2022-03-17T12:08:56+05:30",
    "validTo":"2022-12-17T12:08:56+05:30",
    "bizCreate":"2022-10-12T16:00:56+01:20",
    "codeInfo":{
        "codeNo":"CODE12345678",
        "codePin":"9882323"
    },
    "redirectUrl":"alipayTNGD://platformapi/startapp?appId=2160010059641668&nbsource=debug&nbsn=INSTALL&nbsv=1.1.0&query=campaignName%3Didentityv&path=pages/voucher-detail/voucher-detail?voucherId=1203940129340123941234"
}

response

copy
{
    "voucherId":"20221119190501115401500000000001087200954853",
    "resultInfo":{
        "resultStatus":"S",
        "resultCode":"SUCCESS",
        "resultMessage":"Success."
    }
}