AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","app_id","your private_key","json","GBK","alipay_public_key","RSA2");
AlipayEcoEduKtBillingSendRequest request = new AlipayEcoEduKtBillingSendRequest();
request.setBizContent("{" +
" \"users\":[{" +
" \"user_mobile\":\"18291992024\"," +
"\"user_name\":\"家长姓名\"," +
"\"user_relation\":\"1\"," +
"\"user_change_mobile\":\"1300000000\"" +
" }]," +
"\"school_pid\":\"20880012939123234423\"," +
"\"school_no\":\"11010100000002\"," +
"\"child_name\":\"张晓晓\"," +
"\"grade\":\"高一\"," +
"\"class_in\":\"3班\"," +
"\"student_code\":\"2098453900091\"," +
"\"student_identify\":\"310193199905289483\"," +
"\"status\":\"D\"," +
"\"out_trade_no\":\"20160232343253253453\"," +
"\"charge_bill_title\":\"学生开学收费项\"," +
"\"charge_type\":\"M\"," +
" \"charge_item\":[{" +
" \"item_name\":\"校服费\"," +
"\"item_price\":8.88," +
"\"item_serial_number\":1," +
"\"item_max_num\":5," +
"\"item_mandatory\":\"N\"" +
" }]," +
"\"amount\":88.88," +
"\"gmt_end\":\"2016-01-01 13:13:13\"," +
"\"end_enable\":\"Y\"," +
"\"partner_id\":\"201600129391238873\"" +
" }");
AlipayEcoEduKtBillingSendResponse response = alipayClient.execute(request);
if(response.isSuccess()){
System.out.println("调用成功");
} else {
System.out.println("调用失败");
}
IAopClient client = new DefaultAopClient("https://openapi.alipay.com/gateway.do", "app_id", "merchant_private_key", "json", "1.0", "RSA2", "alipay_public_key", "GBK", false);
AlipayEcoEduKtBillingSendRequest request= new AlipayEcoEduKtBillingSendRequest() ;
request.BizContent="{" +
" \"users\":[{" +
" \"user_mobile\":\"18291992024\"," +
"\"user_name\":\"家长姓名\"," +
"\"user_relation\":\"1\"," +
"\"user_change_mobile\":\"1300000000\"" +
" }]," +
"\"school_pid\":\"20880012939123234423\"," +
"\"school_no\":\"11010100000002\"," +
"\"child_name\":\"张晓晓\"," +
"\"grade\":\"高一\"," +
"\"class_in\":\"3班\"," +
"\"student_code\":\"2098453900091\"," +
"\"student_identify\":\"310193199905289483\"," +
"\"status\":\"D\"," +
"\"out_trade_no\":\"20160232343253253453\"," +
"\"charge_bill_title\":\"学生开学收费项\"," +
"\"charge_type\":\"M\"," +
" \"charge_item\":[{" +
" \"item_name\":\"校服费\"," +
"\"item_price\":8.88," +
"\"item_serial_number\":1," +
"\"item_max_num\":5," +
"\"item_mandatory\":\"N\"" +
" }]," +
"\"amount\":88.88," +
"\"gmt_end\":\"2016-01-01 13:13:13\"," +
"\"end_enable\":\"Y\"," +
"\"partner_id\":\"201600129391238873\"" +
" }";
AlipayEcoEduKtBillingSendResponse response=client.execute(request);
Console.WriteLine(response.Body);
$aop = new AopClient ();
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
$aop->appId = 'your app_id';
$aop->rsaPrivateKey = '请填写开发者私钥去头去尾去回车,一行字符串';
$aop->alipayrsaPublicKey='请填写支付宝公钥,一行字符串';
$aop->apiVersion = '1.0';
$aop->signType = 'RSA2';
$aop->postCharset='GBK';
$aop->format='json';
$request = new AlipayEcoEduKtBillingSendRequest ();
$request->setBizContent("{" .
" \"users\":[{" .
" \"user_mobile\":\"18291992024\"," .
"\"user_name\":\"家长姓名\"," .
"\"user_relation\":\"1\"," .
"\"user_change_mobile\":\"1300000000\"" .
" }]," .
"\"school_pid\":\"20880012939123234423\"," .
"\"school_no\":\"11010100000002\"," .
"\"child_name\":\"张晓晓\"," .
"\"grade\":\"高一\"," .
"\"class_in\":\"3班\"," .
"\"student_code\":\"2098453900091\"," .
"\"student_identify\":\"310193199905289483\"," .
"\"status\":\"D\"," .
"\"out_trade_no\":\"20160232343253253453\"," .
"\"charge_bill_title\":\"学生开学收费项\"," .
"\"charge_type\":\"M\"," .
" \"charge_item\":[{" .
" \"item_name\":\"校服费\"," .
"\"item_price\":8.88," .
"\"item_serial_number\":1," .
"\"item_max_num\":5," .
"\"item_mandatory\":\"N\"" .
" }]," .
"\"amount\":88.88," .
"\"gmt_end\":\"2016-01-01 13:13:13\"," .
"\"end_enable\":\"Y\"," .
"\"partner_id\":\"201600129391238873\"" .
" }");
$result = $aop->execute ( $request);
$responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
$resultCode = $result->$responseNode->code;
if(!empty($resultCode)&&$resultCode == 10000){
echo "成功";
} else {
echo "失败";
}
https://openapi.alipay.com/gateway.do?timestamp=2013-01-01 08:08:08&method=alipay.eco.edu.kt.billing.send&app_id=5144&sign_type=RSA2&sign=ERITJKEIJKJHKKKKKKKHJEREEEEEEEEEEE&version=1.0&biz_content=
{
"users":[{
"user_mobile":"18291992024",
"user_name":"家长姓名",
"user_relation":"1",
"user_change_mobile":"1300000000"
}],
"school_pid":"20880012939123234423",
"school_no":"11010100000002",
"child_name":"张晓晓",
"grade":"高一",
"class_in":"3班",
"student_code":"2098453900091",
"student_identify":"310193199905289483",
"status":"D",
"out_trade_no":"20160232343253253453",
"charge_bill_title":"学生开学收费项",
"charge_type":"M",
"charge_item":[{
"item_name":"校服费",
"item_price":8.88,
"item_serial_number":1,
"item_max_num":5,
"item_mandatory":"N"
}],
"amount":88.88,
"gmt_end":"2016-01-01 13:13:13",
"end_enable":"Y",
"partner_id":"201600129391238873"
}
//为确保安全通信,需自行验证响应示例中的sign值是否为蚂蚁金服所提供。