贝宝SetExpressCheckout肥皂

贝宝SetExpressCheckout肥皂

本文介绍了贝宝SetExpressCheckout肥皂的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试设置setExpressCheckout时,我得到ack =成功,但没有令牌返回.

when i try to setExpressCheckout, i get ack = success but not token return.

paypal api的版本是87.0这里是wsdl链接: https://www.sandbox.paypal.com/wsdl/PayPalSvc. wsdl

the version of paypal api is 87.0Here the wsdl link : https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsdl

在此命令我在axis2-1.6.1中使用它来生成Java代码

here to command i use in axis2-1.6.1 to generate java code

-uri https://www.sandbox.paypal.com/wsdl/PayPalSvc.wsd -p com.paypal.soap

此处是使用axis2生成的Java代码的链接 https://docs.google.com /open?id = 0B97cB4uxjmztbGgxRER6VjBWcWc

here the link to the java code that generated using axis2 https://docs.google.com/open?id=0B97cB4uxjmztbGgxRER6VjBWcWc

此处为SetExpressCheckout的代码

here the code for SetExpressCheckout

    PaymentDetailsType paymentDetails = new PaymentDetailsType();
    BasicAmountType orderTotal = new BasicAmountType();
    orderTotal.setCurrencyID(CurrencyCodeType.USD);
    orderTotal.setString("10.00");
    paymentDetails.setOrderTotal(orderTotal);
    paymentDetails.setPaymentAction(PaymentActionCodeType.Sale);

    SetExpressCheckoutRequestDetailsType requestDetailsType = new SetExpressCheckoutRequestDetailsType();
    requestDetailsType.setCancelURL(buyer.getCancelUrl());
    requestDetailsType.setReturnURL(buyer.getReturnUrl());
    requestDetailsType.setPaymentDetails(new PaymentDetailsType[]{paymentDetails});

    SetExpressCheckoutRequestType requestType = new SetExpressCheckoutRequestType();
    requestType.setVersion("87.0");
    requestType.setSetExpressCheckoutRequestDetails(requestDetailsType);

    SetExpressCheckoutReq req = new SetExpressCheckoutReq();
    req.setSetExpressCheckoutRequest(requestType);

    RequesterCredentials requesterCredentials = new RequesterCredentials();
    CustomSecurityHeaderType customSecurityHeaderType = new CustomSecurityHeaderType();

    UserIdPasswordType userIdPasswordType = new UserIdPasswordType();
    userIdPasswordType.setUsername("<username>");
    userIdPasswordType.setPassword("<pass>");
    userIdPasswordType.setSignature("<signature>");
    customSecurityHeaderType.setCredentials(userIdPasswordType);
    requesterCredentials.setRequesterCredentials(customSecurityHeaderType);

    String endPoint = null;
    endPoint = "https://api-3t.sandbox.paypal.com/2.0/";  //sandbox API Signature
    PayPalAPIInterfaceServiceStub stub = new PayPalAPIInterfaceServiceStub(endPoint);
    stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, false);
    SetExpressCheckoutResponse setExpressCheckout = stub.setExpressCheckout(req, requesterCredentials);

    SetExpressCheckoutResponseType checkoutResponse = setExpressCheckout.getSetExpressCheckoutResponse();
    Calendar timestamp = checkoutResponse.getTimestamp();
    String strdate = null;
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy hh:mm:ss");
    if (timestamp != null) {
        strdate = sdf.format(timestamp.getTime());
    }
    System.out.println("Date:" + strdate);
    System.out.println("CorrelationID:" + checkoutResponse.getCorrelationID());
    System.out.println("ack :" + checkoutResponse.getAck());
    if (checkoutResponse.getErrors() != null && checkoutResponse.getErrors().length > 0) {
        PayPalAPIInterfaceServiceStub.ErrorType[] errors = checkoutResponse.getErrors();
        for (int i = 0; i < errors.length; i++) {
            System.out.println(errors[i].getErrorCode());
            System.out.println(errors[i].getLongMessage());

        }
    }
    System.out.println("token:" + checkoutResponse.getToken());

我得到的结果

Date:17/04/2012 12:33:38
CorrelationID:a7c9fe7283bd
ack :Success
token:null

我如何获得成功的确认,但令牌为null?贝宝的联系人说,已经为CorrelationID:a7c9fe7283bd生成了EC令牌.

how i get ack success but token is null?the contact person for paypal said that there is an EC token already be generated for CorrelationID:a7c9fe7283bd .

提前谢谢.

推荐答案

我必须使用setExpressCheckoutResponse.getExtraElement().getText()来获取令牌.为什么setExpressCheckoutResponse.getToken()返回null?

i have to use setExpressCheckoutResponse.getExtraElement().getText() to get the token. why setExpressCheckoutResponse.getToken() return null?

这篇关于贝宝SetExpressCheckout肥皂的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 13:43