Android:如何通过付款详细信息?

时间:2012-02-29 13:15:07

标签: android paypal

正在研究Mobile Express Checkout LIbrary。我只是将我的应用程序重定向到PayPal但是,我得到了这样的结果 -

Transaction Invalid

我现在该怎么办?我没有将任何付款细节传递给PayPal如何通过它以及我如何完成它。有人帮我这么做吗?

4 个答案:

答案 0 :(得分:2)

所以你从paypal获得了一个devicetoken,并从你的web服务获得了一个令牌?

您使用哪个PayPal网址重定向到PayPal页面? 因为我在SANDBOX模式下遇到了同样的问题..没有解决问题,但实时网址对我有用:

String url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout-mobile&useraction=commit&token=" + token + "&drt=" + deviceToken

令牌参数=从网络服务

收到的交易令牌

deviceToken =令牌来自paypal

仍然无法弄清楚为什么沙盒对我不起作用..

答案 1 :(得分:1)

因此,integration guide是实现此目的时非常好的信息来源。基本上,您传递的URL包含您要查找的所有项目。第16-17页包含您想要的内容。基本上,您希望将URL传递给Paypal服务器,该服务器看起来像这样:

API_SERVER_ADDRESS METHOD = SetExpressCheckout&安培; VERSION = XX.0&安培; USER = API_username&安培; PWD = API_password&安培; SIGNATURE = API_signature&安培; PAYMENTREQUEST_0_AMT =量安培; PAYMENTREQUEST_0_CURRENCYCODE = currencyID

似乎API SERVER ADDRESS可能

https://www.paypal.com/cgi-bin/webscr

但是,如果您不想在文件中包含您的用户名和密码,通常的做法是通过网络服务器搭载它。

答案 2 :(得分:0)

这是完整的代码,可以帮助您完成此paypal功能。剩下的任务只是在https://developer.paypal.com/

上创建一个帐户
{  

      CheckoutButton launchSimplePayment;
      PayPal pp;
      pp = PayPal.getInstance();

    if (pp == null) 
    {
        createPaypalObject();
        //pp = PayPal.initWithAppID(this, "APP-80W284485P519543T",PayPal.ENV_SANDBOX);
    }
    else
    {
        pp.setShippingEnabled(false);
        launchSimplePayment = pp.getCheckoutButton(this,PayPal.BUTTON_118x24, CheckoutButton.TEXT_PAY);
        launchSimplePayment.setOnClickListener( this);
        yourLayout.addView(launchSimplePayment);        

    }

}   

    public void createPaypalObject()
   {
    pp = PayPal.initWithAppID(this, "APP-80W284485P519543T",PayPal.ENV_SANDBOX);
    pp.setShippingEnabled(false);
    launchSimplePayment = pp.getCheckoutButton(this,PayPal.BUTTON_118x24, CheckoutButton.TEXT_PAY);
    launchSimplePayment.setOnClickListener( this);
     handler1.sendEmptyMessage(0);   

   }

   //do this onClick of that payment button
   {
        PayPalPayment payment = new PayPalPayment();
        payment.setSubtotal(new BigDecimal(price_of_song));
        payment.setCurrencyType("USD");
        payment.setRecipient("abc@gmail.com");  //this id must be created by you on payment.paypal.com, this is trial id.
        payment.setPaymentType(PayPal.PAYMENT_TYPE_GOODS);
        Intent checkoutIntent = PayPal.getInstance().checkout(payment, this);
        startActivityForResult(checkoutIntent, 1);
   }



/**This function shows the action by payment paypal*/
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch(resultCode) {
case Activity.RESULT_OK:
//The payment succeeded

        Toast.makeText(this,"Payment has done successfully",Toast.LENGTH_SHORT).show();

break;
case Activity.RESULT_CANCELED:

    Toast.makeText(this,"Payment has cancled",Toast.LENGTH_SHORT).show();
   //The payment was canceled

break;
case PayPalActivity.RESULT_FAILURE:

    Toast.makeText(this,"Sorry Payment failed",Toast.LENGTH_SHORT).show();
   //The payment failed -- we get the error from the EXTRA_ERROR_ID and EXTRA_ERROR_MESSAGE

}
super.onActivityResult(requestCode, resultCode, data);
}

如果有任何疑问,请随时随时问我。

答案 3 :(得分:0)

我已使用Sandbox生成的WebService传递了付款详细信息。现在,我的付款流程遇到了新问题。查看我更新的问题。