0% found this document useful (0 votes)
68 views17 pages

New Cross-Border Website Payment Test Demo Samples

The document provides instructions and examples for testing new cross-border website payment functions including creating a forex trade, querying a single trade, requesting a refund, and comparing files. Code samples and request/response parameters and structures are given for each function.

Uploaded by

dabaxa9060
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views17 pages

New Cross-Border Website Payment Test Demo Samples

The document provides instructions and examples for testing new cross-border website payment functions including creating a forex trade, querying a single trade, requesting a refund, and comparing files. Code samples and request/response parameters and structures are given for each function.

Uploaded by

dabaxa9060
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

New Cross-border Website Payment test demo samples

Contents

New Cross-border Website Payment test .................................................................................. 2


Configuration .................................................................................................................... 2
create_forex_trade ............................................................................................................. 2
Single_Trade_Query ....................................................................................................... 10
forex_refund- return_amount .......................................................................................... 14
Forex_compare_file ........................................................................................................ 16
forex_liquidation_file...................................................................................................... 17

Suggestions and Improvements


If you have any suggestions or complaints, please send them to email “wb-zsz277881@alibaba-
inc.com” , I will try to improve this test document w.r.t your feedback.

Date Description Author version


09/30/2017 Initial Draft Ralian 1.0

Note:

Currently, The demo for merchant’s Reference, which is consistent with " New Cross-border Website Payment test demo samples.pdf" and

is just a sample code to facilitate merchant testing.

So the corresponding code can be written in accordance with the technical requirements of merchant's own requirement, not necessarily

using the code.

1
New Cross-border Website Payment test
Configuration
Set pid and key
You could set the value of parameters “partner”,”private_key”,”ali_public_key” on the page
"AlipayConfig.java", figure as follows:

Set the gateway


You could set the value of “ALIPAY_GATEWAY_NEW” on the page "AlipaySubmit.java", figure as
follows:

create_forex_trade

Test account info on Production env:

Merchant Gateway: https://mapi.alipay.com/gateway.do?

1) International Merchant Account info:

PID:2088021017666931
MD5 key:4508mayei5zbmsmopp6tlobdf83d2k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SICwOiKSj8cOwwIDAQAB

2) Corresponding domestic accounts info:

PID : 2088801766902304

3) Buyer account info :


Buyer account : [email protected]
login password:67917F5
payment password: 515467

Attention:
 IMPORTANT:Please read and follow up the test instructions as the attachment before you
start your test on.
 Try to test with small amounts, such as 0.01, and remember to refund it.

3
4) merchant management background
URL: https://global.alipay.com

Account : [email protected]
password: nativeaccount

4
Function demo:

#1 Click the “确认支付” button

#2 Go to the Alipay Cashier Login Page, if Alipay Account Payment is selected, fill the account and password

5
#3 Fill the payment password

6
#4 Get the successful payment page

7
Demo figure:
a. request parameters and return value:

Examples of payment request parameter are as follows:

_input_charset=utf-8&body=境外收单测试
&currency=HKD&notify_url=http://9119c9f0.ngrok.io/create_forex_trade-JAVA-UTF-8-
Mode RSA_split/notify_url.jsp&out_trade_no=test20170816150740&partner=2088021017666931&product_code=NE
Param W_OVERSEAS_SELLER&return_url=http://9119c9f0.ngrok.io/create_forex_trade-JAVA-UTF-8-
eter RSA_split/notify_url.jsp&service=create_forex_trade&subject=test 商品
123&total_fee=0.01&sign_type=RSA&sign=H6WZp6aQqNkr5j+aclPlSz45L3udPBoXf8KS5CfHKaB1oWdDs
8mte5TPy6GInJCpET0I9aSPc/lXqlTkVee64/01wyHumWQriMW7tB/0Rlko6jImL0QysX4y+sonxHs94t7wmUf
9zAoAcLGZplnsn4n04u4eprBI+3SIqJDd82k=
Please refer to “https://global.alipay.com/service/website_split/6” for the implications of all fields.

Result of callback by this mode. In general, the format of character string is as follows:

http://9119c9f0.ngrok.io/create_forex_trade-JAVA-UTF-8-
Retur RSA_split/notify_url.jsp?sign=Hl1je/x2eB4GgJlU/CHUdWxW4dbLS5U5CMwHq9muoN2zVOEozlaToXqkw
n H3xQY7xNFX63Bdbs4XWuIMRvj+hUB+U92yU8DNekLfARFj/atGQ5Kp7AoULx+4vc68xnbu552dfig3fsyai/
Value hLTqgsOTvgwSO5Z7S1yrZZQfitFLKE=&trade_no=2017081621001003050502834160&total_fee=0.01&sign_
type=RSA&out_trade_no=test20170816150740&trade_status=TRADE_FINISHED&currency=HKD

Please refer to “https://global.alipay.com/service/website_split/7” for the implications of all fields.

b. Notification Parameter Description


Deal with the contents of asynchronous notification:
Pls get rid of sign and sign_type, sort other parameters in alphabetical order from a to z, and link up all array values
by the character of “&”:

currency=HKD&notify_id=5ac226e4cf7822d205cedcc252b54ebge1&notify_time=2017
-08-16
15:24:12&notify_type=trade_status_sync&out_trade_no=test20170816150740&total_fe
e=0.01&trade_no=2017081621001003050502834160&trade_status=TRADE_FINISHE
This character D&sign_type=RSA&sign=NN2trlV3PKBjZN7KS4oE8PG8WkHFqXIvvQl32fJ2FO9J+
string is one to HniSuvv36VYPWbARVmodnTvYVkFmR2FB9ioDX0iRTRRSCkz8+ox3ytrlRdRfaeG
be signed MSGBuHN6WP/tAHscBbNvjkzyshjTCoXO6MFFg92CR2K50DvtNNUerZa/mx4lA5I
=

Please refer to “https://global.alipay.com/service/website_split/9” for the implications of


all fields.

After receiving the pre-sign string during responding from Alipay system, the next step is the same as the procedure
of Sign for request. When the 32-byte signature result string is generated, it should be verified whether the value
is equal to the value of the parameter “sign”. If equal, the verification would be passed.

Attention:
 The parameter without value needs not to be transmitted, nor to be included in the data to be
signed;
 At signing, the character set designated at the time when the character turns into byte stream
shall be consistent with _input_charset;

8
 If the parameter of _input_charset is transmitted, it shall also be included in the data to be
signed.

9
Single_Trade_Query

Function demo:
#1 input the value of trade_no or out_trade_no

#2 get the xml result

Note:
You could get the result string through printing the parameter “strResult” ,as follows:

You could refer to https://global.alipay.com/service/website_split/13 to get more detail request parameters.

10
Demo figure:
a. request parameters and return value:

11
Examples of payment request parameter are as follows:

Mode
_input_charset=utf-
Param 8&partner=2088021017666931&service=single_trade_query&out_trade_no=test20170816150740
eter
Please refer to “https://global.alipay.com/service/website_split/6” for the implications of all fields.

12
Result of callback by this mode. In general, the format of character string is as follows:

<alipay>
<is_success>T</is_success>
<request>
<param name="_input_charset">UTF-8</param>
<param name="service">single_trade_query</param>
<param name="partner">2088021017666931</param>
<param name="out_trade_no">test20170816150740</param>

</request>
<response>
<trade>
<body>境外收单测试</body>
<buyer_email>[email protected]</buyer_email>
<buyer_id>2088122878784050</buyer_id>
<discount>0.00</discount>
<flag_trade_locked>0</flag_trade_locked>
<gmt_create>2017-08-16 15:10:29</gmt_create>
<gmt_last_modified_time>2017-08-16 15:10:35</gmt_last_modified_time>
<gmt_payment>2017-08-16 15:10:35</gmt_payment>

Retur <is_total_fee_adjust>F</is_total_fee_adjust>
n <operator_role>B</operator_role>
Value <out_trade_no>test20170816150740</out_trade_no>
<payment_type>100</payment_type>
<price>0.01</price>
<quantity>1</quantity>
<seller_email>[email protected]</seller_email>
<seller_id>2088021017666931</seller_id>
<subject>test 商品 123</subject>
<to_buyer_fee>0.00</to_buyer_fee>
<to_seller_fee>0.01</to_seller_fee>
<total_fee>0.01</total_fee>
<trade_no>2017081621001003050502834160</trade_no>
<trade_status>TRADE_FINISHED</trade_status>
<use_coupon>F</use_coupon>
</trade>
</response>
<sign>ZolCkiq+X0U2wDlw2h6FRiUc9LGXJTyNebQ/6CYid3dZECh4Kx00NJk3A1LqZ+ibyLR+/uaAsXdPm
KaEmid1IKXgCBT708nqFvMD4pdSfb/KZATudwi3QIM9Z/tNziw1nllS1qHIL6aAq7nsNwJYRKRj6XnJHUpq
9ZLJdF915QQ=</sign>
<sign_type>RSA</sign_type>
</alipay>

Please refer to “https://global.alipay.com/service/website_split/13?_rd=0.30842618539201605#QueryResponse”


for the implications of all fields.

13
forex_refund- return_amount
Function demo:
#1 Fill the value of parameters, as follows, click the “确认” button:

a. Mode parameters:

A request example:

_input_charset=utf-
8&currency=USD&gmt_return=20170930112701&notify_url=http://d5ea6c4c.ngrok.io/
Forex_Refund-JAVA-UTF-
Mode
8/notify_url.jsp&out_return_no=201709301127&out_trade_no=1787254271689725&p
Parameter artner=2088021017666931&product_code=NEW_OVERSEAS_SELLER&reason=shu
zhirefund&return_amount=0.01&service=forex_refund

Please refer to “https://global.alipay.com/service/wap_split/11” for the implications of


all fields.

Result of callback by this mode. In general, the format of character string is as follows:

<?xml version="1.0" encoding="utf-8"?>


<alipay><is_success>T</is_success></alipay>

Return Value

Please refer to
“https://global.alipay.com/service/website_split/11?_rd=0.8250280778900616#Respons
e” for the implications of all fields.

b. Notification Parameter Description


Deal with the contents of asynchronous notification:
Pls get rid of sign and sign_type, sort other parameters in alphabetical order from a to z, and link up all array values
by the character of “&”:

14
currency=USD&notify_id=35775a46c8321cabd6c362c7ee921acgru&notify_time=2017
-09-30
11:28:55&notify_type=refund_status_sync&out_return_no=201709301127&out_trade_
This character no=1787254271689725&refund_status=REFUND_SUCCESS&return_amount=0.01&s
string is one to ign_type=RSA&sign=APBIdLT0F/zSj+PupmywHOF9oBftSAUNqgBXD6doLkds4Ab
be signed u7TvvUbJtArRgV0RtHLgdepS/6TaPwz6WXjxp7a5MXuSF4BGJeR+qPBkxKiliXGV7
e33B6Uqg3nsYBylrzTctD5xXbUwIvOwt4qJAPgC2L3k4vJ8B15bSY4sxJeA=

Please refer to “https://global.alipay.com/service/barcode/24” for the implications of all


fields.

15
Forex_compare_file
Function demo:
#1 Fill the value of parameters, as follows, click the “确认” button:

Demo figure:
a. Mode parameters:

A request example:

_input_charset=utf-
8&end_date=20170724&partner=2088021017666931&service=forex_compare_file&st
Mode art_date=20170715
Parameter

Please refer to
“https://global.alipay.com/service/website_split/15?_rd=0.568511593556954#Forex_co
mpare_file_Request” for the implications of all fields.

Result of callback by this mode. In general, the format of character string is as follows:

Return Value

Please refer to
“https://global.alipay.com/service/website_split/15?_rd=0.3456851381760935#Forex_c
ompare_file_Response” for the implications of all fields.

16
forex_liquidation_file
Function demo:
#1 Fill the value of parameters, as follows, click the “确认” button:

Demo figure:
b. Mode parameters:

A request example:

_input_charset=utf-
8&end_date=20170820&partner=2088021017666931&service=forex_liquidation_file&
Mode
start_date=20170815
Parameter

Please refer to
“https://global.alipay.com/service/website_split/17?_rd=0.9040997315999524#Forex_li
quidation_file_Request” for the implications of all fields.

17

You might also like