Alipay refund in return parameters and interfaces

Alipay refund Interface:

Reference: https: //docs.open.alipay.com/api_1/alipay.trade.refund/ official documents

Directly on the code:

    

/ ** 
     * Alipay refund Interface 
     * @param orderId merchant order number 
     * @param tradeNo Alipay transaction serial number 
     * @param totalAmount refund amount 
     * @return 
     * / 
    public  static the Map alipayCreateOrderRefund (String orderId, tradeNo String, String totalAmount) { 
        the Map Map = new new a LinkedHashMap (); 

        alipayClient alipayClient = new new . DefaultAlipayClient (AlipayConfig aliPayUrl, 
                AlipayConfig.appId, AlipayConfig.developerSpoon,
                 "JSON", AlipayConfig.input_charset, AlipayConfig.aliPaySpoon, "RSA2" );
        Request AlipayTradeRefundRequest = new new AlipayTradeRefundRequest (); 

        AlipayTradeRefundModel Model = new new AlipayTradeRefundModel (); 
        model.setOutTradeNo (orderId); // when incoming orders to pay the merchant order number 
        model.setTradeNo (tradeNo); // Alipay transaction number 
        model.setRefundAmount ( totalAmount); // REFUND_AMOUNT required refund amount, this amount is not greater than the order amount, unit membered 

        request.setBizModel (Model); // request parameter 

        AlipayTradeRefundResponse Response = null ;
         the try { 
            Response =alipayClient.execute (Request); 
            System.out.println (JSONObject.fromObject (Response) .toString ()); 
            the Map tuiMap = JSONObject.fromObject (Response); 

        } the catch (AlipayApiException E) { 
            String Massage = "alipay.trade. refund refund Interface: orders signature error " ; 
            System.out.println (Massage); 
        } 
        IF (response.isSuccess ()) { 
            System.out.println ( " call is successful " ); 
            map.put ( " Status ", 0 ); // Order refund status: 0 success 1: failure 
            logger.info ( "Alipay: payment Order to pay the result of the query: orders out_trade_no ----" + orderId + "! --- Order Returns success" );
        } the else { 
            System.out.println ( "call failed" ); 
            map.put ( "Status", 1); // Order Refund status: 0 Success 1: Failure 
            logger.info ( "Alipay: Payment Order to pay the result of the query: orders out_trade_no ---- "+ orderId +" --- orders refund failed "! ); 
        } 
        return the Map; 
    }

 

Refund success parameters such as the following:

退款成功:
{
    "body":"{"alipay_trade_refund_response":{"code":"10000","msg":"Success","buyer_logon_id":"185******13","buyer_user_id":"2088422483503995","fund_change":"N","gmt_refund_pay":"2019-08-13 17:48:25","out_trade_no":"12337925","refund_fee":"0.01","send_back_fee":"0.00","trade_no":"2019081322001403990517324158"},"sign":"dNhUcD9THBOpAigyklYLyaNqUOEv2IpxENZLshgG4dzQkKa04GvVU1a9dqib98osDOEYAnGf1RNzm1QZvvw / 9ybVCWMkQK0C / NO + TV135 + 7DZ2DfSqmtG + JsEugQM4lHJfsVm / QUIU9kprPOeuKJAoAw + fLVXaSgFT + hsnatHUpR0F + 3ail / jpQDfonneMfJanMuAxbfA2LVlxHVpIaoC73yyHK0WEQNrSwnp0pTEO30uqnLi4EehiV + Wo8bSdGr9ilzAEmq1bcDsNQuftE + 4TU / I4J5KyhjAJos4SbOU + 98fQylwSqdG16Od3lDEuusedPq5bz1yoW + mDW0peU5i + d} == "" " "buyerUserId:" 2088422483503995 ",
    "" buyerLogonId: "185 ***** * "13,
    "code":"10000",
    "errorCode":"10000",
    "fundChange":"N",
    "gmtRefundPay":{
        "date":13,
        "day":2,
        "hours":17,
        "minutes":48,
        "month":7,
        "seconds":25,
        "time":1565689705000,
        "timezoneOffset":-480,
        "year":119
    },
    "msg":"Success",
    "openId":"",
    "outTradeNo":"12337925",
    "params":{
        "biz_content":"{"out_trade_no":"12337925","refund_amount":"0.01","trade_no":"2019081322001403990517324158"}"
    },
    "presentRefundBuyerAmount":"",
    "presentRefundDiscountAmount":"",
    "presentRefundMdiscountAmount":"",
    "refundCurrency":"",
    "refundDetailItemList":[

    ],
    "refundFee":"0.01",
    "sendBackFee":"0.00",
    "storeName":"",
    "subCode":"",
    "subMsg":"",
    "success":true,
    "tradeNo":"2019081322001403990517324158"
}

Be resolved according to their own business on the line, and then process the order on the line

Guess you like

Origin www.cnblogs.com/wyf-love-dch/p/11347575.html