Paypal Express Checkout中的空指针异常并且还给出空白页面

时间:2014-02-28 13:07:08

标签: java jsp paypal

在快速结账时,显示总计,但产品名称和其他详细信息未显示     并给出错误NUll指针异常并添加'='然后显示空白

public HashMap CallShortcutExpressCheckout(String item, String paymentAmount, String currencyCodeType, String paymentType, 
                                            String returnURL, String cancelURL,
                                            HttpSession session)
{
    session.setAttribute("paymentType", paymentType);
    session.setAttribute("currencyCodeType", currencyCodeType);

    /* 
    Construct the parameter string that describes the PayPal payment
    the varialbes were set in the web form, and the resulting string
    is stored in $nvpstr
    */
    String nvpstr = "&PAYMENTREQUEST_0_AMT=" + paymentAmount + "&PAYMENTREQUEST_0_PAYMENTACTION=" + paymentType + "&ReturnUrl=" + URLEncoder.encode( returnURL ) + "&CANCELURL=" + URLEncoder.encode( cancelURL ) + "&PAYMENTREQUEST_0_CURRENCYCODE=" + currencyCodeType;

         nvpstr=nvpstr+ "&L_PAYMENTREQUEST_0_NAME0="+item;
         nvpstr=nvpstr+ "&L_PAYMENTREQUEST_0_QTY0="+item;
          nvpstr=nvpstr+ "&L_PAYMENTREQUEST_0_AMT0="+item;
         System.out.println("item="+item);
    /* 
    Make the call to PayPal to get the Express Checkout token
    If the API call succeded, then redirect the buyer to PayPal
    to begin to authorize payment.  If an error occured, show the
    resulting errors
    */
        System.out.println("amountpay="+paymentAmount);
        HashMap nvp = httpcall("SetExpressCheckout", nvpstr);
    String strAck = nvp.get("ACK").toString();
    if(strAck !=null && strAck.equalsIgnoreCase("Success"))
    {
        session.setAttribute("TOKEN", nvp.get("TOKEN").toString());
    }

    return nvp;
}

并显示空白的expresscheckout.jsp

0 个答案:

没有答案