trade.close

Updated at:

Closes an unpaid transaction if the user does not complete payment within a specified period after the transaction is created.

Common request parameters

Parameter

Type

Required

Maximum length

Description

Example

app_id

String

Required

32

Mini program ID

2014072300007148

method

String

Required

128

API name

trade.close

format

String

No

40

Only JSON is supported

JSON

charset

String

Required

10

Request encoding format, such as utf-8, gbk, or gb2312.

utf-8

sign_type

String

Required

10

Signature algorithm type used by the merchant to generate the signature string. RSA2 and RSA are supported. RSA2 is recommended.

RSA2

sign

String

Required

344

Signature string of the merchant request parameters. For more information, see the signature.

See the example in this topic.

timestamp

String

Required

19

Time when the request is sent, in the format yyyy-MM-dd HH:mm:ss

2014-07-24 03:07:50

version

String

Required

3

API version. Fixed value: 1.0

1.0

biz_content

String

Required

-

Collection of request parameters with no maximum length. All request parameters except common parameters must be passed in this parameter. For details, see the quick integration documentation for each product.

-

Business request parameters

Parameter

Type

Required

Maximum length

Description

Example

out_trade_no

String

Required

64

Merchant order number, customized by the merchant. Must be within 64 characters and can only contain letters, numbers, and underscores. Must be unique on the merchant side.

20150320010101001

trade_no

String

Required

64

Platform transaction serial number for this transaction. Length: 16 to 64 characters. Cannot be empty at the same time as out_trade_no. If both are provided, trade_no takes precedence.

2013112611001004680073956707

Common request example

Default example:

curl 'https://xxx/gateway.do?charset=UTF-8&method=trade.close&format=json&sign=${sign}&app_id=${appid}&version=1.0&sign_type=RSA2&timestamp=${now}' \
 -F 'biz_content={
	"trade_no":"2013112611001004680073956707",
	"out_trade_no":"HZ0120131127001"
}' 
Note

This example is for reference only.

Common response parameters

Parameter

Type

Required

Maximum length

Description

Example

code

String

Required

-

Gateway return code.

40004

msg

String

Required

-

Description of the gateway return code.

Business Failed

sub_code

String

No

-

Business return code. For more information, see the specific API documentation.

ACQ.TRADE_HAS_SUCCESS

sub_msg

String

No

-

Description of the business return code. For more information, see the specific API documentation.

The transaction has been paid

sign

String

Required

-

Signature

DZXh8eeTuAHoYE3w1J+POiPhfDxOYBfUNn1lkeT/V7P4zJdyojWEa6IZs6Hz0yDW5Cp/viufUb5I0/V5WENS3OYR8zRedqo6D+fUTdLHdc+EFyCkiQhBxIzgngPdPdfp1PIS7BdhhzrsZHbRqb7o4k3Dxc+AAnFauu4V6Zdwczo=

Business response parameters

Parameter

Type

Required

Maximum length

Description

Example

out_trade_no

String

Required

64

Merchant order number

20150423001001

trade_no

String

Required

64

Platform transaction number

2015042321001004720200028594

Response example

{
    "trade_create_response": {
        "code": "10000",
        "msg": "Success",
        "out_trade_no": "20150423001001",
        "trade_no": "2015042321001004720200028594"
    },
    "sign": "ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE"
}