3

Am working on Mobile Express Checkout LIbrary. I just redirect my app to PayPal But, i got like this -

Transaction Invalid

What can i do for this now? I didn't pass any payment details to PayPal How do pass it and how do i finished it. Anyone help me to do this?

8
  • One more important thing is that, after done registration on developer.paypal.com we need to do two more task to use them in our code. 1. verify that account 2. then create one test account to use in our code. Mar 1, 2012 at 5:31
  • @SpK : I am implementing MECL for my app, can you please guide me on this if you have completed integrating it, I want to know what parameters to send in SetExpressCheckout method to get an Authentication token from my Server? Aug 17, 2012 at 6:45
  • @mirroredAbstraction Have you seen this Aug 17, 2012 at 6:49
  • @SpK yes I did, you used SOAP, I plan on using NVP, any ideas, by the way it will be generous of you if you mentioned the list of parameters you passed in setExpressCheckout method to make it work Aug 17, 2012 at 6:52
  • @mirroredAbstraction For, this you've to write some php file which will be redirect from return url. Aug 17, 2012 at 7:21

4 Answers 4

2
+100

So u get a devicetoken from paypal, and a token from your webservice?

Wich PayPal URL are u using to redirect to the PayPal page? Because i had the same problem in SANDBOX mode.. Didn't solve the problem but the live url worked for me:

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

token param = transaction token wich is received from the webservice

deviceToken = token u get from paypal

Still can't figure out why the sandbox didnt work for me..

5
  • I got a device token from PayPal only using this code. See my code Mar 6, 2012 at 4:45
  • i think the parameters of your url aren't corrent. I editted my answer above with the full url
    – Luciano
    Mar 6, 2012 at 9:12
  • And were do you get a token from your webservice i can't find that in your code..
    – Luciano
    Mar 6, 2012 at 9:21
  • Use of this code i can get the devicetoken. What's token here Mar 6, 2012 at 9:53
  • The above two pastebin code only for my PayPal classes. If i missed anything means,please come here Android People and explain me detailed. Mar 6, 2012 at 9:57
1

So, the integration guide is an excellent source of information when implementing this. Basically, you pass it a URL with all of the items you are looking for. Page 16-17 contains what you want. Essentially you want to pass a URL to the Paypal server that looks something like this:

API_SERVER_ADDRESS?METHOD=SetExpressCheckout&VERSION=XX.0&USER=API_username&PWD=API_password&SIGNATURE=API_signature&PAYMENTREQUEST_0_AMT=amount&PAYMENTREQUEST_0_CURRENCYCODE=currencyID

It seems likely the API SERVER ADDRESS is

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

However, if you don't want to include your username and password in the file, the common practice is to piggyback this via a web server.

0

This is complete code which will help you to do this paypal functionality. The remaining task for you only is create an account on 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("[email protected]");  //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);
}

If any query then feel free to ask me anytime.

1
0

I've passed the payment details using this WebService which is generated by Sandbox. Now, am getting a new problem with payment process. Check my updated question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.