Reputation: 24476
Am working on Mobile Express Checkout LIbrary. I just redirect my app to PayPal
But, i got like this -
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?
Upvotes: 3
Views: 1806
Reputation: 24476
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.
Upvotes: 0
Reputation: 39698
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.
Upvotes: 1
Reputation: 2798
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..
Upvotes: 2
Reputation: 6186
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.
Upvotes: 0