Prepay
Referred to as prepay
post
https://mapi.yuansfer.com/micropay/v3
/prepay
Prepay
Response
Parameter | Type | Description |
result | object | The wechat-mini result object. The wechat-app result object. The alipay-app result object. |
ret_msg | string | The response return message. |
ret_code | string |
wehcat-mini result object
Parameter | Type | Description |
timeStamp | string | The timestamp. |
nonceStr | string | A random string. |
package | string | prepay_id information. |
signType | string | The signature type. |
paySign | string | The signature. |
wechat-app result object
Parameter | Type | Description |
appid | string | The App Id. |
noncestr | string | A random string. |
package | string | The value is 'Sign=WXPay'. |
partnerid | string | partnerid information. |
prepayid | string | prepay_id information. |
sign | string | The signature. |
timestamp | string | The timestamp. |
alipay-app result object
Parameter | Type | Description |
payInfo | string | The payment information. |
cURL
PHP
Java
Go
curl -XPOST -H "Content-type: application/json" -d '{
"merchantNo": "200043",
"storeNo": "300014",
"verifySign": "09f722178f6cf2e71c9dfdd664e8663b",
"amount": "10",
"currency": "CNY",
"settleCurrency": "USD",
"ipnUrl": "http://zk-tys.yunkeguan.com/login/test",
"reference": "test2020101302",
"description": "司机支付会员费用",
"vendor": "wechatpay",
"terminal": "MINIPROGRAM",
"openid": "ocBgh5fnabrf-pxPgCWXlq2mOvG8"
}' 'https://mapi.yuansfer.com/micropay/v3/prepay'
<?php
function microprepay()
{
$url = 'https://mapi.yuansfer.com/micropay/v3/prepay';
$token = '5cbfb079f15b150122261c8537086d77a';
$params = [
'merchantNo' => '200043',
'storeNo' => '300014',
'amount' => '0.01',
'currency' => 'USD',
'settleCurrency' => 'USD',
'vendor' => 'wechatpay',
'ipnUrl' => 'https://nengjtian.s1.natapp.cc/login/test',
'reference' => 'test2018070101',
'description' => 'test_description',
'note' => 'test_note',
'openid' => '***'
];
ksort($params, SORT_STRING);
$str = '';
foreach ($params as $k => $v) {
$str .= $k . '=' . $v . '&';
}
$params['verifySign'] = md5($str . md5($token));
echo 'verifySign:', $params['verifySign'];
echo "\n";
$ch = curl_init($url);
curl_setopt_array($ch, array(
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HEADER => false,
CURLOPT_POST => true,
CURLOPT_POSTFIELDS => http_build_query($params),
));
$result = curl_exec($ch);
curl_exec($ch);
echo $result;
echo "\n";
return json_decode($result, true);
}
microprepay();
?>
public class MicropayTest {
public static final String TEST_URL = "https://mapi.yuansfer.yunkeguan.com"; //testing domain
public static final String PROD_URL = "https://mapi.yuansfer.com"; //production domain
public static final String YUANSFER_TOKEN = "5c5fe30183be69fceff8174358d4b8ae";
public static void main(String[] args) {
YuansferVerifySignHelper helper = new YuansferVerifySignHelper();
AppMircopayDto dto = paramSetting();
Map<String, Object> params = ReflectionUtils.convertBean2MapIgnoreNullVal(dto, new String[]{"serialVersionUID"});
String verifySign = helper.getYuansferVerifySign(params, YUANSFER_TOKEN);
params.put("verifySign", verifySign);
String url = TEST_URL + "/micropay/v2/prepay";
String ret = HttpClientUtils.post(url, null, params);
System.out.println(ret);
}
public static AppMircopayDto paramSetting() {
AppMircopayDto dto = new AppMircopayDto();
/**
* merchantNo,storeNo is necessory, and they are provided by Yuansfer
*/
dto.setMerchantNo("200043"); //The Merchant NO.
dto.setStoreNo("300014"); //The Store NO.
/**
* transaction infomation is necessory
*/
dto.setAmount("0.01"); //The amount, unit "division"
dto.setCurrency("USD"); //currency, "USD"
dto.setSettleCurrency("USD"); //SettleCurrency, "USD"
dto.setIpnUrl("https://nengjtian.s1.natapp.cc/login/test"); //Asynchronous callback address
dto.setReference("9091023122"); //order NO. of client's system
dto.setOpenid("***"); //wechat openid
dto.setVendor("wechatpay"); //"wechatpay"
/**
* note,desription are optional
*/
dto.setDescription("test-description"); //description
dto.setNote("test-note"); //note
return dto;
}
}
func mciropay(t *table) {
req := yuan.Securepay{
MerchantNo: "200043", //customer The merchant NO.
StoreNo: "300014",
Currency: "USD",
SettleCurrency: "USD",
Amount: "0.01",
Vendor: "wechatpay",
Reference: fmt.Sprintf("demo_%d", time.Now().Unix()), //sequence number of customer system
IpnUrl: "https://customer-ipn", //internet accessible
Description: "description",
Note: "note",
Openid: "***",
}
resp, err := req.PostToYuansfer(yuansferToken)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(resp)
}
Last modified 3mo ago