当前位置: 首页>>代码示例>>Java>>正文


Java AlipayTradePagePayRequest.setReturnUrl方法代码示例

本文整理汇总了Java中com.alipay.api.request.AlipayTradePagePayRequest.setReturnUrl方法的典型用法代码示例。如果您正苦于以下问题:Java AlipayTradePagePayRequest.setReturnUrl方法的具体用法?Java AlipayTradePagePayRequest.setReturnUrl怎么用?Java AlipayTradePagePayRequest.setReturnUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alipay.api.request.AlipayTradePagePayRequest的用法示例。


在下文中一共展示了AlipayTradePagePayRequest.setReturnUrl方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tradePage

import com.alipay.api.request.AlipayTradePagePayRequest; //导入方法依赖的package包/类
/**
 * 电脑网站支付(PC支付)
 * @param httpResponse
 * @param model
 * @param notifyUrl
 * @param returnUrl
 * @throws {AlipayApiException}
 * @throws IOException
 */
public static void tradePage(HttpServletResponse httpResponse, AlipayTradePayModel model, String notifyUrl, String returnUrl) throws AlipayApiException, IOException{
	AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
	request.setBizModel(model);
	request.setNotifyUrl(notifyUrl);
	request.setReturnUrl(returnUrl);
	String form  = AliPayApiConfigKit.getAliPayApiConfig().getAlipayClient().pageExecute(request).getBody();//调用SDK生成表单
	httpResponse.setContentType("text/html;charset=" + AliPayApiConfigKit.getAliPayApiConfig().getCharset());
	httpResponse.getWriter().write(form);//直接将完整的表单html输出到页面
    httpResponse.getWriter().flush();
    httpResponse.getWriter().close();
}
 
开发者ID:Javen205,项目名称:IJPay,代码行数:21,代码来源:AliPayApi.java

示例2: tradePage

import com.alipay.api.request.AlipayTradePagePayRequest; //导入方法依赖的package包/类
/**
 * 电脑网站支付(PC支付)
 * 
 * @param httpResponse
 * @param model
 * @param notifyUrl
 * @param returnUrl
 * @throws AlipayApiException
 * @throws IOException
 */
public static void tradePage(HttpServletResponse httpResponse, AlipayTradePayModel model, String notifyUrl,
    String returnUrl) throws AlipayApiException, IOException {
    AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
    request.setBizModel(model);
    request.setNotifyUrl(notifyUrl);
    request.setReturnUrl(returnUrl);
    String form = AliPayConfig.build().getAlipayClient().pageExecute(request).getBody();// 调用SDK生成表单
    httpResponse.setContentType("text/html;charset=" + AliPayConfig.build().getCharset());
    httpResponse.getWriter().write(form);// 直接将完整的表单html输出到页面
    httpResponse.getWriter().flush();
    httpResponse.getWriter().close();
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:23,代码来源:AliPay.java

示例3: tradePage

import com.alipay.api.request.AlipayTradePagePayRequest; //导入方法依赖的package包/类
/**
 * 电脑网站支付(PC支付)
 * 
 * @param model
 * @param notifyUrl
 * @param returnUrl
 * @return
 * @throws AlipayApiException
 * @throws IOException
 */
public static void tradePage(HttpServletResponse httpResponse, AlipayTradePayModel model, String notifyUrl,
		String returnUrl) throws AlipayApiException, IOException {
	AlipayTradePagePayRequest request = new AlipayTradePagePayRequest();
	request.setBizModel(model);
	request.setNotifyUrl(notifyUrl);
	request.setReturnUrl(returnUrl);
	String form = AliPayConfig.build().getAlipayClient().pageExecute(request).getBody();// 调用SDK生成表单
	httpResponse.setContentType("text/html;charset=" + AliPayConfig.build().getCharset());
	httpResponse.getWriter().write(form);// 直接将完整的表单html输出到页面
	httpResponse.getWriter().flush();
	httpResponse.getWriter().close();
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:23,代码来源:AliPay.java

示例4: doTradePagePay

import com.alipay.api.request.AlipayTradePagePayRequest; //导入方法依赖的package包/类
public static Map<String, String> doTradePagePay(AlipayConfig config) {

        AlipayClient alipayClient = AlipayClientCreator.getAlipayClient(config);
        AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();
        alipayRequest.setReturnUrl("http://domain.com/CallBack/return_url.jsp");
        alipayRequest.setNotifyUrl("http://domain.com/CallBack/notify_url.jsp");//在公共参数中设置回跳和通知地址
        alipayRequest.setBizContent("{" +
                "    \"out_trade_no\":\"20150320010101001\"," +
                "    \"product_code\":\"FAST_INSTANT_TRADE_PAY\"," +
                "    \"total_amount\":88.88," +
                "    \"subject\":\"Iphone6 16G\"," +
                "    \"body\":\"Iphone6 16G\"," +
                "    \"passback_params\":\"merchantBizType%3d3C%26merchantBizNo%3d2016010101111\"," +
                "    \"extend_params\":{" +
                "    \"sys_service_provider_id\":\"2088511833207846\"" +
                "    }"+
                "  }");//填充业务参数

        try {
            AlipayTradePagePayResponse response = alipayClient.pageExecute(alipayRequest);
            if (response.isSuccess()) {

            }
        } catch (AlipayApiException e) {
            e.printStackTrace();
        }

        return null;
    }
 
开发者ID:daishicheng,项目名称:outcomes,代码行数:30,代码来源:AlipayUtil.java

示例5: testProxy

import com.alipay.api.request.AlipayTradePagePayRequest; //导入方法依赖的package包/类
@RequestMapping(value = "/fpwxtest", method = RequestMethod.GET)
public String testProxy() throws IOException {

    AlipayClient alipayClient = AlipayClientCreator.getAlipayClient(alipayConfig);

    AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();//创建API对应的request
    alipayRequest.setReturnUrl("http://domain.com/CallBack/return_url.jsp");
    //alipayRequest.setNotifyUrl("http://domain.com/CallBack/notify_url.jsp");//在公共参数中设置回跳和通知地址

    ObjectMapper objectMapper = new ObjectMapper();
    objectMapper.setPropertyNamingStrategy(PropertyNamingStrategy.SNAKE_CASE);

    AlipayBizContent bizContent = new AlipayBizContent();
    String param = objectMapper.writeValueAsString(bizContent);
    alipayRequest.setBizContent(param);

    log.info(param);

    String form="";
    try {
        form = alipayClient.pageExecute(alipayRequest).getBody(); //调用SDK生成表单
    } catch (AlipayApiException e) {
        e.printStackTrace();
    }

    return form;
}
 
开发者ID:daishicheng,项目名称:outcomes,代码行数:28,代码来源:RfiController.java

示例6: pay

import com.alipay.api.request.AlipayTradePagePayRequest; //导入方法依赖的package包/类
/**
 * 用于跳转支付,同步通知
 *
 * @param response
 * @return
 */
@GetMapping("/pay")
public String pay(String order_id,Authentication auth, HttpServletResponse response) throws IOException {
    if (auth == null) {
        return "404";
    }
    //如果订单主键被修改或者置空,设置跳转错误
    if (order_id == null) {
        return "404";
    }
    ShopOrder shopOrder = shopOrderService.findOrderById(order_id);
    if (shopOrder == null) {
        //订单不存在,进行订单的错误处理
        return "404";
    }
    StringBuffer ordername = new StringBuffer();
    for (ShopOrderDetail sod : shopOrder.getShopOrderDetails()) {
        String temp =sod.getShopProduct().getProName().replace(" ", "");
        ordername.append(temp);
    }
    String desc="";
    if (ordername.toString().length()>MAX_LENGTH){
       desc=ordername.substring(0,MAX_LENGTH);
    }

    //获得初始化的AlipayClient
    AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, "json", AlipayConfig.charset, AlipayConfig.alipay_public_key, AlipayConfig.sign_type);
    //设置请求参数
    AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();
    alipayRequest.setReturnUrl(AlipayConfig.return_url);
    alipayRequest.setNotifyUrl(AlipayConfig.notify_url);

    //商户订单号,商户网站订单系统中唯一订单号,必填
    String out_trade_no = new String(shopOrder.getOrder_no().getBytes(), "UTF-8");
    //付款金额,必填
    String total_amount = new String(shopOrder.getSubPrice().toString().getBytes(), "UTF-8");
    //订单名称,必填
    String oname="OML商城支付";
    String subject = new String(oname.getBytes(), "UTF-8");
    //商品描述,可空
    String body = new String(desc.getBytes(), "UTF-8");

    alipayRequest.setBizContent("{\"out_trade_no\":\"" + out_trade_no + "\","
            + "\"total_amount\":\"" + total_amount + "\","
            + "\"subject\":\"" + subject + "\","
            + "\"body\":\"" + body + "\","
            + "\"timeout_express\":\"10m\","
            + "\"product_code\":\"FAST_INSTANT_TRADE_PAY\"}");

    //请求参数可查阅【电脑网站支付的API文档-alipay.trade.page.pay-请求参数】章节
    String result = "";
    try {
        //请求
        result = alipayClient.pageExecute(alipayRequest).getBody();
    } catch (Exception e) {
        e.printStackTrace();
    }
    //输出
    response.setContentType("text/html;charset=" + AlipayConfig.charset);
    //直接将完整的表单html输出到页面
    response.getWriter().write(result);
    response.getWriter().flush();
    response.getWriter().close();
    return null;
}
 
开发者ID:TZClub,项目名称:OMIPlatform,代码行数:71,代码来源:PayController.java


注:本文中的com.alipay.api.request.AlipayTradePagePayRequest.setReturnUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。